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. Every-time 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…
nikoo28
nikoo28
a tech-savvy 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 to capture moments in my life. It's my pleasure to have you here.
-
-
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.
-
You are given an array that is sorted but also rotated by an unknown number of times. Given a target value, return the index if it can be found. In this post we discuss the solution to this problem using a modified version of the binary search technique.
-
Radix Sort is an unconventional sorting technique that does not work based on comparison. It works best when all the input elements of a list has the same number of characters.
-
Given an array, find the indices of 2 elements, that have a sum equal to the given target value.