# Category Archives: Algorithms

Given a binary tree, the task is to: Print all the leaf nodes and then delete them all.  Repeat this process till the tree becomes… Read More
Given an integer N, the task is to construct the longest possible array A[], such that the following conditions hold: A[0] = N. No two… Read More
Given an array arr[] of N integers, the task is to sort the array by replacing any element at index i (arr[i]) with arr[j] –… Read More
Given a Binary Tree where each node has a value of either 0 or 1, the task is to convert the given Binary tree to… Read More
Given integers N and K, the task is to construct an array arr[] of size N using numbers in the range [1, N] such that… Read More
Given a large integer N, the task is to find the largest possible integer which is divisible by 9 after inserting exactly one digit from… Read More
Given an array arr that contains N positive Integers. Find the count of all possible pairs whose bit wise XOR value is greater than bit… Read More
Given an array arr that contains N positive Integers. Find the count of all possible pairs whose bitwise XOR value is greater than bitwise AND… Read More
Given an array arr[] having N integers, and an integer K, the task is to find an array such that it contains a single elements… Read More
Given an array Arr[], the task is to find out the minimum number of operations to make the sum of array elements lesser or equal… Read More
Given a tree of having N nodes rooted at node 0, and an array val[] denoting the value at each node, the task is to… Read More
Given an array arr[] of size N, the task is to maximize the array sum by subtracting the absolute values of all odd and adding… Read More
Given an integer N, find the number of natural numbers less than or equal to N and have 4 factors. Example:  Input: N = 8Output:… Read More
Given a binary array arr[] of size N and an integer K, the task is to find the highest index which can be reached in… Read More
Given an array arr[] of size N, an integer K and Q queries, each of form {x, l, r}. For each query, the task is… Read More