DEV Community

Mukilan Palanichamy
Mukilan Palanichamy

Posted on

My journey in Competitive programming

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.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay