Hello, People! Today I managed to solve three problems in LeetCode: Single Number, First Missing Positive, and Next Greater Element III. There is a general mistake that each of us, including myself, makes. For example, when we find such an easy problem, perhaps we tend to skip it, or use some familiar algorithm to solve it as a matter of course, instead of looking further. However, use resources in finding whether or not the solution you find is the most efficient; if not, take your time to learn the better solution.
Single Number is an easy problem, and I knew of one solution. However, I was curious to know whether there existed an even better solution. So, when I found it, I was really surprised that the problem could be solved in such an efficient way.
Similarly, when solving First Missing Positive and Next Greater Element III, it is very important to focus on building a solid logic first. Then break it down into smaller steps this will simplify the process. Approaching problems in this way helps to develop better solutions.
I hope my experience will be helpful to you.
Top comments (0)