Let us try to understand this problem statement first. We have some strings that needs to be super reduced in size. The string consists of english alphabets from a to z, and they can be duplicated at some places. If we see two adjacent characters that are same, they can be eliminated. Following this pattern we have to return a super compressed/reduced string. Let us look at some sample test cases: Input: aabcccddOutput: “bc”Explanation:aabcccdd > bcccdd > bcdd > bc(we eliminate two same adjacent characters at each step) Input: abbaOutput:…
nikoo28
nikoo28
a techsavvy guy and a design buff... I was born with the love for exploring and want to do my best to give back to the community. I also love taking photos with my phone and Canon Kiss X5 in order to capture moments in my life. It's my pleasure to have you here.


Let us try to understand this problem statement first. We are in charge of a fancy circus and 2 kangaroos have to jump on a number line. The interesting part is that both the kangaroos have a different start position, and different jump distances. It is a little tricky to understand, the problems asks to calculate the number line jumps such that both the kangaroos are at the same position. We will try to simplify this using some diagrams, and see how the kangaroos actually jump. In the given test…

Delete a node from a linked list at 3 places. Beginning, end and somewhere in the middle. It is all about updating the pointers.

Let us try to understand this problem statement first. It is actually very verbose. We will try to simplify it as much as possible. Christy wants to give chocolates to her colleagues, and at the same time tries to ensure that everyone has equal chocolates at the end. To achieve this she either gives 1,2, or 5 chocolates to everyone except any one individual. Everytime she does this, it is counted as 1 operation. We need to make sure that Christy can achieve this task in the minimum number of…

Question: Given a two strings, find the minimum number of characters that must be deleted to make them anagrams. Input: str1 = “a b c”, str2 = “a m n o p”Output: 6 Let us try to understand this problem statement and its test case first. We have two strings of english alphabet which may or may not have the same length. Anagrams are two words with same characters and frequencies. It is not necessary that the order of the characters is same. We have to determine, how many total…

Question: Given a string, count the number of times the letter ‘a’ is repeated. Input: str = “abcac”, n= 10 Output: 4 Let us try to understand this problem statement and its test case first. You have a string of lowercase English letters, that is repeated infinitely many times. Along with it, you also have a number ‘n’. You need to find out how many times the letter a appears in the first n characters of this infinite string. Let us look at a sample test case. Upon looking at…

A queue is a linear data structure working on First In First Out policy. But some use cases can require different solutions. We can create different queue types with the same basic idea. This post describes more about them

Given an array of integers, find the elements that appear twice. The main challenge of this problem is to solve it without using any extra space. You need to find a way to mark the elements that are already encountered. Once such way would be to make the elements negative. This post gives you 2 different solutions a video explanation.

You are in charge of birthday cake candles at a party. However, the child can only blow out the tallest candles.
Read this post to know how you can find out the number of candles that get blown out along with the full implementation. 
Given an array of strings, group all the anagrams together. This post explores 2 methods to solve this problem. You can create groups by sorting, or by categorizing using the frequency of characters.