Given an array of positive numbers arr[] and integer K. You have to choose the maximum number possible from left to right such that each… Read More
Category Archives: Arrays
Given a 2D array span[][] of length N which contains spans [L, R] (0 ≤ L ≤ R ≤ 109), the task is to merge… Read More
Samwell laid out N bowls in a straight line and put a few marbles randomly in each bowl, ith bowl has A[i] marbles. A bowl… Read More
There are N jobs and the start and finish times of the jobs are given in arrays start[] and end[] respectively. Each job requires one… Read More
Given a sorted array A[] of length N. For each i(0 ≤ i ≤ n-1), you have to make all the elements of the array… Read More
Given two integers N (N ≥ 1) and K (K ≥ 1), where N denotes the number of petrol pumps from 1 to N and… Read More
Given 2 sorted arrays Ar1 and Ar2 of size N each. Merge the given arrays and find the sum of the two middle elements of… Read More
Given an integer array A[] of size N and integer k. For a fixed value p, choose an index i (1 ≤ i ≤ n)… Read More
An array is a collection of items of same data type stored at contiguous memory locations Array example Types of Arrays: One-dimensional Array: It is… Read More
Given an unsorted permutation array of size N and an integer K ( 1 ≤ K ≤ N ), the task is to sort this… Read More
Given a boolean array a[] of size N and integer K. Initially, all are marked false. We have to choose 2 different indexes having the… Read More
Given an array X[] of length N, the task is to find the minimum number of times the operation is used to sort X[], if… Read More
Given two integers N and X. Then the task is to return YES or NO by checking whether there exists a subarray in any permutation… Read More
Given an undirected graph, a source node src, and an integer K, the task is to print all nodes after level K from the source… Read More
Given an array arr[] of length, N, the task is to find how many powerful subarrays are present in the array. Note: A powerful subarray… Read More