DEV Community

Mukilan Palanichamy
Mukilan Palanichamy

Posted on

My journey in Competitive programming

Hello, Friends! Today, I solved three problems on LeetCode: Permutation Sequence, Maximum Number of K-Sum Pairs, and Longest Palindromic Substring. We can solve both Maximum Number of K-Sum Pairs and Longest Palindromic Substring by using the two-pointer technique, while for Permutation Sequence, a logical approach can be used.

The two-pointer technique can also be connected to our day-to-day life. Consider an instance where we want to search for a book on the shelf. If only one person is searching, it will take a longer time compared to two people searching together. Similarly, the two-pointer technique involves traversal of an array from both ends: the first pointer starts at index zero, moving from left to right, while the second pointer starts at the last index, moving from right to left. This simultaneous traversal helps us reach the target in a shorter time.

To solve Permutation Sequence, we use a very logical approach. The understanding behind this problem often needs one or two dry runs of the code. It is often really hard to explain the solution in words so it might be helpful to use further resources if you have not been able to solve this on your own. But understanding the concept and the logic behind the code solves this problem.

Hope so, my experience will come in handy!

Top comments (0)