Skip to content

Category Archives: Arrays

Given an array arr[] of size N, the task is to rearrange the array elements such that all the Prime numbers are placed before the… Read More
Given two arrays arr[] and brr[] of size N and M integers respectively, the task is to maximize the sum of the product of the… Read More
Given an array arr[] consisting of N pairs, where each pair represents the value and ID respectively, the task is to check if it is… Read More
Given an array arr[] consisting of N positive integers representing the lengths of N ropes and a positive integer K, the task is to find… Read More
Given an array arr[] consisting of N positive integers, the task is to sort the array in increasing order with respect to the count of… Read More
Given an array arr[] consisting of N integers and an array Q[] of M pairs representing a query of type {X, Y}, the task is… Read More
Given an array arr[] consisting of N integers, the task is to minimize the cost of converting all array elements to a Fibonacci Number, where… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the maximum sum of pairs of elements that… Read More
Given an array arr[] consisting of N integers, the task is to find the number of pairs such that the GCD of any pair of… Read More
Given two arrays A[] and B[] consisting of N and M integers respectively, and an integer K, the task is to find the sum nearest… Read More
Given an array arr[] consisting of N integers, the task is to find the product of the count of set bits in the binary representation… Read More
Given an array arr[] consisting of first N natural numbers, where arr[i] = i ( 1-based indexing ) and a positive integer K, the task… Read More
Given an array arr[] consisting of N positive integers and an array Query[][2] consisting of Q queries of the form {L, R}, the task is… Read More
Given an array arr[] consisting of N integers, the task is to find the maximum possible value of the expression (arr[i] * arr[j]) + (arr[j]… Read More
Given an array arr[] consisting of N integers, the task is to print the smaller of the two subsets obtained by splitting the array into… Read More