How much time should I spend on a difficult DSA problem before reading its editorial?

Often I am asked this question by our students at Programming Pathshala, how much time they should spend on a problem, if they find it difficult to solve?

Hi, my name is Bharat Khanna and I am one of the Co-Founder here at Programming Pathshala. During my preparation of coding interviews, I used to divide problem solving into following parts -

  1. Reading and understanding the problem — Lets take an example problem.This problem looks very complicated by its statement. But, if you calmly try to understand it, you will get that it just wants you to look at all the query subarrays for different [l,r]. Those subarrays which have a positive sum should be taken in answer and their sum is to be added to total answer.

You should analyse during your preparation the weak part.

  • If part 1 is weak, try to practice reading multiple questions and dry running your understanding on sample cases.

To answer your question, ponder hard and try to atleast reach till part 2 always. Then if you are unable to improve beyond a certain point in part 3, ask for hints if you have mentorship. If not, go for the editorial but note down the pattern you missed and make sure the pattern gets mapped for future

Hope you find it useful for when you start solving a problem next time.

For more information, you can also login to and take a free trial today.

Have a doubt? Reach out to us at



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Programming Pathshala

We are working to democratise access to Tech Education. We help students learn coding and be confident about themselves.