Hi, Folks! Today, I solved three problems on LeetCode: Simplify Path, Score of Parentheses, and Longest Palindromic substring. As learners, we have to increase the complexity of problems step by step. We should not start with complex problems. Try to start with moderate level problems and gradually increase the complexity.
There are so many problems in LeetCode that start at moderate level and increases the complexity level step by step. As a Beginner, at first I felt really hard to solve palindrome problem. after solving this problem the level of problem increases which is one of the question solved by me today, Longest palindromic substring. In this way slowly increase the level of problems. If, on the first day itself, I had tried to solve longest palindromic substring problem, it might not be a easy task, and I might lost interest in problem solving.
Score of Parentheses: Traverse through the input string. Use the stack data structure to update the count. If you find the opening bracket, increment the count. If not, try to pop it from the stack. In this way we can solve this problem.
Simplify Path : Traverse through the input string. Use the stack data structure to update the output string. Depending on input special characters either pop it or push it into stack. In this way, we can solve this problem.
I hope my experience will be helpful.
The above is the detailed content of Increase the complexity step-by-step. For more information, please follow other related articles on the PHP Chinese website!