Sir doubt in this question

sir this code is working for 3 test cases but for 4th test cases it is showing runtime error here is the code

hello @tejasddongare
check the constraints->
image

ur solution space complexity is O(nk) that is why is showing run error for one case (nk is too much space).

try to solve this in linear space complexity.

refer this->link

sir now i did space optimaztion still its failing one test case why?? rest all test cases are getting passed

@tejasddongare
u r not reading sum