PLEASE HELP ME APPROACH THIS QUESTION

TSOH
BXRED
Please help with these 2 questions I have just started CP.
In the 2nd question my approach was to just take 2 boxes which suits to condition and mark them visited and then in similar go search for the rest, N - the total count obtained is the solution of what I have done.
Pls help

This approach is correct but only thing is that you have traverse the array in reverse sorted order and then do the same that you mentioned above.

Thanks, When the problem will start accepting Solution I will check it.
Once again Thank you!!!

1 Like

Here are my solutions in C++ and python:
https://github.com/Sky-Nik/CodeChef/tree/main/Pop20-Push21
For BXRED I used binary search over the answer, and for TSOH I used dp.

I also recorded a livesolve + editorial, I will publish it on YouTube and add a link here once video processing finishes

Thanks, I will Subscribe it