Given an array arr[] of size N, the task is to minimize the array sum after replacing array elements with positive integers in a way… Read More

# Category Archives: Algorithms

Given a non-negative integer N, the task is to generate an array such that if any two elements of that array are replaced by their… Read More

Given an array arr[] of size N and an integer K, denoting the maximum value an array element can have, the task is to check… Read More

Given an array arr[] containing N integers, the task is to check whether the array is monotonic or not (monotonic means either the array is… Read More

Given a singly linked list, the task is to Count the pairs of nodes with greater Bitwise AND than Bitwise XOR. Examples: Input: list: 1->4->2->6->3Output:… Read More

Given a Non-Negative integer N, denoting the first 2N positive integers where consecutive integers starting from 1 are paired with each other, the task is… Read More

Given an array A[] having N positive integers, the task is to perform the following operations and maximize the sum obtained while reducing the array:… Read More

Given an array arr[] of N small and/or large numbers, the task is to find the largest and smallest number in this array. Examples: Input:… Read More

Given a binary string str of size N, the task is to calculate the bitwise XOR of all substrings of str. Examples: Input: str =… Read More

Given a binary string S of length N, the task is to minimize the count of operations required to find a binary string T of… Read More

Given, a binary tree, the task is to convert this tree using minimum number of increment-decrement operations into a tree which satisfies the following conditions:… Read More

Given an integer N, the task is to construct and print an Array, such that: The size of array is N The elements in array… Read More

Given two integers L and R, the task is to find the count of numbers in the range [L, R] which have only 2 or… Read More

There are N stairs, a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs… Read More

Given an array arr[] of size N, and an integer K, the task is to maximize the first element of the array in K operations… Read More