Failing testcases for Painter Problem

Hi,
My code is failing for the first 4 test cases and passing for the rest. Please let me know where my logic is wrong!
Question link: https://hack.codingblocks.com/app/contests/1786/1062/problem
My solution: https://ide.codingblocks.com/s/368856

hello @yashjain0112

check ur updated code here->

1 Like

It worked, Thanks <3
I thought it was already sorted! Silly mistake.