Hi, people! Today, I have solved three problems on LeetCode: Maximum Value at a Given Index in a Bounded Array, Maximum Length of Pair Chain, and Push Dominoes. This week, aside from revision, I have added some new problems to my plan. I plan out the whole week on Monday really helps a lot. No need to think every day about what to practice! We will get clarity on our plan and can schedule all other daily tasks accordingly.
To solve Maximum Value at a Given Index in a Bounded Array, we need to build an array for which the sum of elements in the array is less than or equal to the target sum given as an input and the length of the created array should be equal to the target length. We can efficiently manage the left and the right sides by using the technique of two pointers and managing the sum for both sides, and this is how this problem is solved.
In Maximum Length of Pair Chain, we need to check if every chain satisfies the given constraints. If a chain does satisfy the given constraints, we count that chain; otherwise, we skip it. We can sort all chains and then by iterating over them, checking the constraints, and counting them, return the result, thereby solving the problem properly.
I hope my experience will be helpful!
Top comments (0)