# Problem Solving for SIlver

What is your problem-solving process or mindset when approaching and solving a problem?

First, it’s obviously important to read the problem and understand it thoroughly. Afterward, read the constraints of the problem and see what complexity your algorithm should be (usually O(n)). Afterward, try to figure out what type of problem it is (greedy, DP, graph, etc). Once you figure out what the likely strategy of the problem is, I guess make sure that strategy works, and if it does, then implement.

I feel like the other answer wasn’t very detailed about the mindset/ approach, so ill add in my own process. For me, if the problem seems like it can be cheesed with a mathematical expression, I start with that. But usually, that isn’t the case, so then I start with just an algorithm of any time complexity, that can solve the problem. Then you have to figure out what is taking the algorithm the most time. which calculation is being repeated? if it’s a search, maybe try two pointers/binary search, if it’s a calculation, maybe try prefix sums or (in gold, but studying gold is helpful for silver) BI Trees, Sparse tables, etc. Since coming up with the solution is what (at least for me) is the most difficult part, the faster you write, the more time you’ll have to think. The key here is to do as many problems as you can so once you have the idea, you can quickly implement it (~30min implementation is a good goal)

2 Likes