you give 0indexed array positive integer task represent task need complete order tasksi represent type ith taskyou give positive integer space represent minimum number day pass completion task task type performedeach day task complete eithercomplete task task ortake breakreturn minimum number day need complete task Example 1input task 121231 space 3Output 9explanationone way complete task 9 day followsDay 1 Complete 0th taskDay 2 Complete 1st taskDay 3 take breakday 4 take breakday 5 Complete 2nd taskday 6 Complete 3rd taskDay 7 take breakday 8 Complete 4th taskday 9 complete 5th taskit show task complete 9 daysexample 2input task 5885 space 2output 6explanationone way complete task 6 day followsDay 1 Complete 0th taskDay 2 Complete 1st taskDay 3 take breakday 4 take breakday 5 Complete 2nd taskday 6 complete 3rd taskit show task complete 6 day Constraints1 taskslength 1051 tasksi 1091 space taskslength