Hi, Folks! 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 using the two-pointer technique, while Permutation Sequence can be solved with a logical approach.
We can relate the two-pointer technique to our daily lives. For example, let’s say we are searching for a book on a shelf. If only one person is searching, it will take longer compared to two people searching together. Similarly, the two-pointer technique involves traversing an array from both sides: 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 faster.
To solve Permutation Sequence, we use a logical approach. Understanding the logic behind this problem often requires multiple dry runs of the code. Explaining the solution in words can be challenging, so it might be helpful to consult additional resources if you’re struggling to solve it on your own. Grasping the concept and logic behind the code is essential for solving this problem.
I hope my experience will be helpful!
Top comments (0)