Category Archives: Algorithms

Given undirected weighted graph G, the task is to find the Maximum Spanning Tree of the Graph using Prim’s Algorithm Prims algorithm is a Greedy… Read More
Given a 2D square matrix arr[][] of dimensions N x N, the task is to find the maximum path sum by moving diagonally from any… Read More
Given an array arr[] consisting of N integers and an integer X, the task is to perform integer division on the array elements by X… Read More
Given two binary strings str1 and str2 having same length, the task is to find if it is possible to make the two binary strings… Read More
Given an array arr[], the task is to find the count of array elements satisfying the following conditions: The array elements should be strictly greater… Read More
Given an array arr[] and an integer value K, the task is to count the maximum number of array elements that can be selected such… Read More
Given an integer N, the task is to count the number of ways to represent N as the sum of powers of 2. Examples: Input:… Read More
Given two integers N and K, the task is to find whether it is possible to represent N as the sum of exactly K powers… Read More
Given two arrays arr1[] and arr2[] of size N and M respectively, the task is to count the minimum number of swapps required between the… Read More
Given a array of strings S[] of size N (1 ≤ N ≤ 105), sort characters of each string in descending order and then print… Read More
Given a binary string S of length N (1 ≤ N ≤ 105), the task is to print a permutation A consisting of integers 0… Read More
Given an array arr[] consisting of 2* N elements in the form of { a1, a2, …, aN, b1, b2, …, bN }, the task… Read More
Given a XOR linked list, the task is to pairwise swap the elements of the given XOR linked list . Examples: Input: 4 7 9… Read More
Given an XOR linked list, the task is to remove the first node of the XOR linked list. Examples: Input: XLL = 4 < –… Read More