Skip to content

Instantly share code, notes, and snippets.

@epalaz
Last active April 16, 2021 19:13
Show Gist options
  • Save epalaz/2eef0f282c36bf4d2651f0f904e04afb to your computer and use it in GitHub Desktop.
Save epalaz/2eef0f282c36bf4d2651f0f904e04afb to your computer and use it in GitHub Desktop.
Interview Question Explanation

Create a data structure that will implement the below interface.

Plan { planId: string; planType: string; planYear: int; planName: string; }

addPlan(Plan plan)

getPlan(string planId)

getAllPlans()

getPlansCount()

getPlansForYear(int year)

getPlansCountByYear(int year)

getPlansForType(string planType)

removePlan(string planId)

getPlansForTypeAndYear(string planType, int planYear)

updatePlan(Plan plan)

Extra

Plans change from year to year in the insurance industry, this is called crosswalk. Crosswalk record consists of

CrosswalkRecord { fromPlanYear: int, fromPlanId: string, toPlanYear: int, toPlanId: string }

Can you edit this data structure to hold crosswalk structure too ?

It will have these two additional methods

getNextYearPlan(string planId)

getPrevYearPlan(string planId)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment