# Category Archives: Arrays

Given an array arr[] of N integers, the task is to find the length of the longest subarray where the sum of the elements in… Read More
Given an array arr[] of positive integers, the task is to find the count of all triplets such that XOR of two equals the third… Read More
Given a 0-based n x n integer matrix where grid[x][y] represents the height of the blocks in row x and column y. You can increase… Read More
Given an array A[] of size N. You have to take another array B of size N and fill it with all 0’s. Find the… Read More
Given an array, arr[] of size N, and an integer K, the task is to check if it is possible to form a permutation from… Read More
Invariants and Monovariants are the two properties of mathematics and computer science that describe objects and algorithms. Invariants and mono variants are important mathematical concepts… Read More
Given an array arr[], the task is to find the minimum positive integer x (x > 1) such that for every ai for (0 ≤… Read More
Block sort is a sorting algorithm that sorts an array by dividing it into blocks of fixed size, sorting each block individually, and then merging… Read More
Smooth sort is a sorting algorithm that was introduced by Edsger Dijkstra. It is another version of heapsort that is designed to minimize the number… Read More
Given a positive integer array arr[] of size N, the task is to print the longest non-empty subarray whose bitwise AND is maximum in the… Read More
To get a value from a multidimensional array containing objects in C++, you can use the same syntax as you would for a regular multidimensional… Read More
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
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