Given an arrays arr[] of size N and an array of queries Q[] of size M, where Q[i] defines the count of unique elements that… Read More

# Category Archives: Arrays

Given a positive integer N, the task is to print the last remaining element from a sequence [1, N] after repeatedly removing all the odd-indexed… Read More

Given a graph consisting of N nodes, where each node represents an exam and a 2D array Edges[][2] such that each pair of the exam… Read More

Given an array A[] consisting of N positive integers, the task is to construct an array B[] of size N having maximum possible sum of… Read More

Given an array arr[] consisting of N integers, the task is to find the maximum number of pairs of array elements such that each pair… Read More

Given an array arr[] consisting of N integers and a positive integer K, the task is to maximize the number of subsets having a product… Read More

Given an array arr[] consisting of N positive integers and a positive integer K such that there are N countries, each country has arr[i] players,… Read More

Given an array arr[] ( 1-based indexing ) consisting of N integers, the task is to find the minimum sum of the absolute difference between… Read More

Given a 2D array arr[][] consisting of N*N positive integers, the task is to generate an N-length array such that Greatest Common Divisors(GCD) of all… Read More

Given two arrays arr[] and brr[] of size N and an integer K. Consider two sets A, contains K initially, and B, initially empty. In… Read More

Given an array arr[] consisting of N integers, the task is to check if the array can be sorted by swapping adjacent elements any number… Read More

Given an array, arr[] of size N where arr[i] represents the number of tickets, the ith seller has and a positive integer K. The price… Read More