Runtime error in my code

https://ide.codingblocks.com/s/152198 Given test case is going well but isn’t working for others

Hello @tanjuljain19,
It is given that Every painter can paint only contiguous segments of boards. Have you taken care of that condition?

Also for run time error:
while (s <= e) {

		if (isValid(boards, p, b, mid)) {
			ans = mid;
			e = mid - 1;
		} else {
			s = mid + 1;
		}
	}

The isValid loop is running infinitely. So please correct that.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.