code: https://ide.codingblocks.com/s/426097
prob: https://hack.codingblocks.com/app/contests/2022/1258/problem
code: https://ide.codingblocks.com/s/426097
prob: https://hack.codingblocks.com/app/contests/2022/1258/problem
Hello @raghav007 your code is producing the correct result for all the test cases . try to submit it again.
test case 1 is still failing
@raghav007 yes i have just checked your code’s logic is fine but implementation is not according to constraints i think.
try do it with using queue only instead o recursion.
check this is the corrected code: