Skip to content

Category Archives: Arrays

Given an array of 1s and 0s which has all 1s first followed by all 0s. Find the number of 0s. Count the number of… Read More
Given an unsorted integer (positive values only) array of size ‘n’, we can form a group of two or three, the group should be such… Read More
Given an array arr[] of size n where every element is in the range from 0 to n-1. Rearrange the given array so that arr[i]… Read More
Similar to Stack, Queue is a linear data structure that follows a particular order in which the operations are performed for storing data. The order is… Read More
Given an array of integers, find the sum of its elements. Examples: Input : arr[] = {1, 2, 3}Output : 6Explanation: 1 + 2 +… Read More
Given an integer array and a positive integer k, count all distinct pairs with differences equal to k.  Examples:  Input: arr[] = {1, 5, 3,… Read More
Hello everyone, I recently got selected for the internship at Microsoft IDC. GeeksForGeeks helped me a lot in preparing for the coding tests as well… Read More
Given an array of random numbers, Push all the zero’s of a given array to the end of the array. For example, if the given… Read More
Given a string, recursively remove adjacent duplicate characters from the string. The output string should not have any adjacent duplicates. See the following examples. Examples: … Read More
Given a rope of length n meters, cut the rope in different parts of integer lengths in a way that maximizes product of lengths of… Read More
Given K sorted arrays of size N each, merge them and print the sorted output. Examples: Input: K = 3, N = 4, arr = {… Read More
Given a set of numbers, find the Length of the Longest Arithmetic Progression (LLAP) in it.  Examples:  set[] = {1, 7, 10, 15, 27, 29}… Read More
Given a sorted array arr[] (may be distinct or may contain duplicates) of size N that is rotated at some unknown point, the task is… Read More
Given a sequence of non-negative integers, find the subsequence of length 3 having maximum product with the numbers of the subsequence being in ascending order.… Read More
Given an array of size n and an integer k, find all elements in the array that appear more than n/k times.  Examples: Input: arr[]… Read More