# Category Archives: Arrays

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
Given an array arr[] of integers. Find a peak element i.e. an element that is not smaller than its neighbors.  Note: For corner elements, we… Read More
Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be… Read More
Given an array of integers, sort the array according to frequency of elements. For example, if the input array is {2, 3, 2, 4, 5,… Read More
An array contains both positive and negative numbers in random order. Rearrange the array elements so that positive and negative numbers are placed alternatively. A… Read More
The cost of a stock on each day is given in an array. Find the maximum profit that you can make by buying and selling… Read More
Given an array of size n, the array contains numbers in the range from 0 to k-1 where k is a positive integer and k… Read More
Given a set of time intervals in any order, merge all overlapping intervals into one and output the result which should have only mutually exclusive… Read More