Given an array pos[] that represents N points on the X axis, a variable cur that represents the current position, and an array time. Where… Read More
Category Archives: Arrays
Given an array A[] of N integers, the task is to find the number of subarrays of A[], which is the repetition of its’ elements… Read More
Given, an array arr[] of N integers, the task is to select some integers from this array arr[] and arrange them in another array brr[],… Read More
Given an array arr[] of size N containing only +1 and -1, the task is to make the sum of the array zero with the… Read More
Given a matrix arr[][] of size N * M, the task is to find the maximum sum of diagonals for each cell of the matrix… Read More
Given an integer array A consisting of N integers. In one move, we can choose any index i ( 0 ≤ i ≤ N-1) and… Read More
Given an array arr[] of integers, the task is to minimize its sum by creating groups of up to size k. Each group consists of… Read More
Given an array of integers arr[] and an integer k, we need to find the maximum sum of a subsequence such that the index difference… Read More
Given two arrays A and B with lengths N and M respectively, the problem is to count the number of elements in array B that… Read More
Given an array arr[] of integers of size n where n is even, the task is to calculate the number of pairs (i, j) such… Read More
Given two arrays color[] and radius[] of length N each, where color[i] represents the color of the ith ball while radius[i] represents the radius of… Read More
Given N and M which is the size of the array a[] and b[] respectively. You have to distribute each element from array b to… Read More
Given an array A[] of N integers, the task is to find min(A[0], A[1], …, A[i-1]) – min(A[i+1], A[i+2], …, A[n-1]) for each i (1… Read More
Given an array arr[] of positive integers, the task is to find the count of all the pairs (X, Y) in the array such that… Read More