Hi, friends! Today, I worked on three LeetCode problems: Fruits into Baskets, Max Number of K-Sum Pairs, and Maximum Length of a Concatenated String with Unique Characters. I used all three to work on reviving one concept that matters: recursion. There are thousands of LeetCode problems, but the concepts never go beyond thousand. It would be right to focus more on concept learning than solving thousands of problems.
We will use the technique of two pointers to solve Max Number of K-Sum Pairs. If we need to find two numbers that are maximum or minimum, or when we're trying to reach a specific target, we use two pointers. One pointer starts at zero index and the other one at the last index. In this way, we can cover the list in both ways and solve the problem.
We will solve Maximum Length of a Concatenated String with Unique Characters using recursion because we are supposed to repeat the same thing over and over again until we have concatenated all the unique strings in the array. We must check that all the strings are unique. That way, we can solve the problem.
We will traverse through the fruits array to find any two types of fruits that are repeated the most, then return the total number of these fruits as output. That's how we can solve this problem.
Hope my experience will be helpful.
Top comments (0)