Hi everyone! Today, I solved three problems on LeetCode: Jump Game, Triangle, and Min Stack. In both the Jump Game and Triangle problems, we have to find an efficient logic to solve them. In the Min Stack problem, we need to use the stack data structure. Always make sure to review the problems you've completed at least once a week. This will help you connect previously learned concepts with newly learned ones.
The algorithm used to determine the solution of the problem Jump Game reads through input array, keeps track of the farthest index accessible, and checks whether a jump can cover the final index of the input. If it's possible then return true. Otherwise return false.
In solving the Triangle problem, nested for loops can be employed to travel through the triangle and to find the smallest element on each level of the triangle. We include these minima in total. Thus, we would be able to solve the problem with this approach.
In the Min Stack problem, we will implement a stack and come up with some methods, namely, push, pop, top, and getMin. In doing so, this is helpful in solving our problem easily.
I hope my experience is helpful to you.
Top comments (0)