Click here to see the problem details. Problem Overview We will be given a string (s) and a substring (part). We have to remove all occurrences from the string based on the given substring. We will continue to remove until all the occurrences of the substring are removed. Each time we have to remove the […]

# Tag: Problem Solving

## Truncate Sentence | LeetCode 1816 | Python | Solution

Here is the problem link. Problem Overview This is an easy problem, and it’s basically a string-related problem. I hope you already read the problem description from the given link. So we will be given a string and an integer. The given string is basically a sentence which is a list of words separated by […]

## Shuffle String | LeetCode 1528 | Python | Solution

Click here to see the problem details. Problem Overview This problem is quite simple. We will be given a string (s) and an array (indices) that is the same length as the string. All of the integers of the array are unique, and of course, all the integers will be less or equal to the […]

## Merge Two Sorted Lists | LeetCode 21 | Python | Solution

Click here to see the problem details. Problem Overview The problem description is pretty straightforward. We are given two sorted Linked List. And we have to merge those given Lists into one sorted list. That’s the problem. Suppose our given two lists are 1 -> 3 and 2 -> 4. And the result will be […]

## Insert into a Binary Search Tree | LeetCode 701 | Python | Solution

Click here to see the problem details. Read the problem details first. Concept This is clearly a Tree related problem and a medium-type problem. In my sense, it’s not that difficult if you have a basic concept about BST (Binary Search Tree). BST is also a Binary Tree. So what is a Binary Search Tree? […]

## Check if the Sentence Is Pangram | LeetCode 1832 | Python | Solution

Click here to see the problem details. It’s an easy LeetCode problem with straightforward problem details. In a simple word, we will be given a sentence to check it is Pangram or not. So, what is Pangram? According to the problem description, “A pangram is a sentence where every letter of the English alphabet appears […]

## Valid Palindrome | LeetCode 125 | Python | Solution

Click here to see the problem details on LeetCode. Before solving this problem, we have to know about palindrome. According to the definition of Wikipedia: A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar. Wikipedia The problem says that we […]

## Reverse Only Letters | LeetCode 917 | Python | Solution

Click here to see the problem details. Problem Overview The problem description is pretty precise. It says that we have to return the reverse version of the given string. But we can only reverse letters. Characters that are not a letter stay in the same place. Only letters will change their position. Let’s see an […]

## Binary Tree Preorder Traversal | LeetCode 144 | Python | Solution

Click here to see the problem on LeetCode. The problem description is pretty straightforward. We have to return all the nodes’ values following the preorder traversal algorithm. I can assume that you have a basic understanding of Tree data structure. Mainly, there are four types of traversing algorithms in Binary Tree. Preorder traversal is one […]

## Monotonic Array | LeetCode 896 | Python | Solution

Here is the link to the problem. See the problem description. We have to check the given array is monotonic or not. What is a monotonic array? “An array is monotonic if it is either monotone increasing or monotone decreasing.” line quoted from the problem description. The formula is:For checking increasing monotone of the given […]