MLE in Class PhotoGraph

I have a solution that runs fine but has space = 10^6 *4 * 10^2 i think the recusion call stack is also eating up space and hence i get a MLE. Can you help with the coding part.

Hey @utkarsh.lal9430310535 this is my personalised code https://ide.codingblocks.com/s/309723 I hope this would help you in understanding the question in a better manner :slight_smile:

It also gives MLE, can you give another one

This should have passed all the test cases, can you tell me which test case number you are failing?

Last 3 test cases are giving MLE.

Might be a glitch, cause this got accepted last time. I would suggest you to leave this and try your next question. :slight_smile:

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.