Hi, Folks! Today I solved three problems on LeetCode: Basic Calculator, Permutations and Maximum Subarray.
For Basic Calculator problem, we can use stack manage operators and parentheses. By popping elements when needed. This way and logic makes the basic calculator as a easier problem.
The Permutation problem can be solved using recursion. We can repeat the same function execution until all the possible combinations are added to result. In this way we can solve permutations problems on LeetCode.
The Maximum Subarray problem can be solved using single for loop. We iterate over the array to find the maximum sums, which helps us to identify maximum subarray. In this way we can solve the maximum subarray problem.
There are many problems around us which can be solved using data structures. Understanding how to apply these structures, like using a stack in the calculator problem, makes the problem more interesting and helps us to connect various concepts.
I hope my experience will be helpful.
Top comments (1)
Hey @karthika_movva, nice to see you improving your problem solving skill with data structure. It would be great if you can share in more details on the approaches you take and why you pick to solve the problem in that way. By that we readers can learn and also share our experiences too.
Problem solving is something that can be amplify when we are able to learn from others and understanding the constraint that we might have when we are solving it. Not all solution can fit with all problems.