Home Author
Author

# nikoo28

• Arrays

## [Leetcode] : Find All Duplicates in an Array Solution

9 minutes read

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.

• Arrays

## [Hackerrank] – Birthday Cake Candles Solution

9 minutes read

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.

• Strings

## [Leetcode] – Group Anagrams Solution

15 minutes read

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.

• Arrays

## [Leetcode] – Search in a Rotated Sorted Array Solution

15 minutes read

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.

• Theory

## Radix Sort

10 minutes read

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.

• Arrays

## [Leetcode] – Two Sum Solution

11 minutes read

Given an array, find the indices of 2 elements, that have a sum equal to the given target value.

• Theory

## Bucket Sort

11 minutes read

Bucket Sort is a sorting technique which puts limitations on the input set to get an improved performance. But, before we start learning about this, let us take a quick recap. This is essential so that you understand what are the use cases of Bucket Sort. The sorting techniques that work in an average time complexity of are: Selection Sort Insertion Sort Bubble Sort Some sorting techniques that have an average time complexity of are: Merge Sort Quick Sort Counting Sort is a special sorting technique that does not work …

• Arrays

## [Hackerrank] – Queue using two stacks

10 minutes read

A queue is a linear data structure which maintains the order in which the elements appear. You need to implement a queue, using two stacks such that it behaves in the same way. If you are unfamiliar with the queue data structure and the stack data structure, it would be a good idea to learn them before approaching this problem. Problem Statement: The basic crux of the problem is that you are to implement a queue and its operations using stacks. It may seem unnecessary in the beginning, as a …

• ## Array Data Structure

8 minutes read

An array is the most basic data structure one can think of. It may seem very easy to use and in a lot of my posts we have been solving problems using arrays. However, if you are just getting started with programming this post is probably for you. I would like to cover some of the basic concepts that makes this data structure so desirable and easy to use. If you have been programming for a while now this post is probably not written for you. Read along keeping that …

• Strings

## [Hackerrank] – Sherlock and the Valid String Solution

8 minutes read

Question: Given a string, Sherlock considers it valid if all the characters in the string occur the same number of time. However, a string is also valid if the frequencies are same after removing any one character. Example 1:Input: str = “aabbcd”Output: NO Example 2:Input: str = “abcc”Output: YES Problem Statement: Let us try to simplify the problem statement first. Sherlock needs to verify if a given string is valid. A string is valid under 2 conditions: All characters of the string appear the same number of times. If you …

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More