you give 0indexed integer array cost costsi cost hire ith workeryou give integer k candidate we want hire exactly k worker accord follow rulesyou run k session hire exactly worker sessionin hiring session choose worker low cost candidate worker candidate worker break tie smallest indexfor example cost 327712 candidate 2 hiring session choose 4th worker low cost 327712in second hiring session choose 1st worker low cost 4th worker small index 32772 please note indexing change processif few candidate worker remain choose worker low cost Break tie small indexA worker choose oncereturn total cost hire exactly k worker Example 1input cost 17121027211208 k 3 candidate 4output 11explanation we hire 3 worker total the total cost initially 0 in hire round choose worker 17121027211208 the low cost 2 break tie small index 3 the total cost 0 2 2 in second hire round choose worker 1712107211208 the low cost 2 index 4 the total cost 2 2 4 in hire round choose worker 171210711208 the low cost 7 index 3 the total cost 4 7 11 Notice worker index 3 common workersThe total hiring cost 11example 2input cost 1241 k 3 candidate 3output 4explanation we hire 3 worker total the total cost initially 0 in hire round choose worker 1241 the low cost 1 break tie small index 0 the total cost 0 1 1 Notice worker index 1 2 common 3 worker in second hire round choose worker 241 the low cost 1 index 2 the total cost 1 1 2 in hire round candidate we choose worker remain worker 24 the low cost 2 index 0 the total cost 2 2 4the total hiring cost 4 Constraints1 costslength 1051 costsi 1051 k candidate costslength