Code works on my offlie IDE, shows compilation error in Hackerblocks ide

hello @anshufirefox this is the question in which you have to use dynamic programming otherwise it will give TLE.
have you reached to the topic of dynamic programming in your course.
also the code is running fine but it is giving wrong answer that means your logic is wrong.


i have made correction but it will not pass all test cases until we will use DP here.
Happy Learning !!

This is not a question that I am solving, I am simply using the Coding blocks online IDE. So inputting the test case etc does not really matter here. There has to be some reason why it’s not working on online ide while it runs smoothly for small values in offline ide (Code::Blocks)

I just passed a constant value instead of N (Small value such as 4 and 5) in the function and it works.

hey @anshufirefox online ide’s work for the general test case i.e according to seconds whereas offline ide’s have no such property.
they may not fall for large test cases but online ide’s will definitely fall for the large test cases unledd they are optimized.
so you need to think according to that.
coding blocks ide isonline ide.

Thank you so much for helping. Please allow me to close this thread by sending the rating link.

hey @anshufirefox you can just mark this doubt as resolved.

There’s some glitch with my profile. It doesn’t close that way. After marking it as resolved if I refresh the page, it again gets marked as unresolved.

please try to mark the doubt as resolved in sometime.
i have asked the mentor to look into this.
you can drop the mail at [email protected]

Thank you, hope it gets resolved soon :slight_smile:

@anshufirefox welcome!

Could you please help me close this thread by sending the rating link? (I’m unable to close it by marking it as resolved. The button doesn’t work on my profile. Have reported it to the support team)

Hello @anshufirefox i cant do it either it is the glitch from the beckend.

There’s some rating link that can be sent fro your end. It helps close the thread too

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.