# Category Archives: Algorithms

Given a 4-digit number with at least two distinct digits, Your program should perform the following operations on the number:  Arrange the digits in descending… Read More
Given a binary tree and a node start that is initially infected. For every second, neighbours of an infected node get infected. The task is… Read More
Given a 2D array arr[][] of size N * M, the value in arr[][] represents the value of coins, the task is to maximize the… Read More
Given N nodes, where each of them is numbered from 0 to N – 1, and array edges, where there is a directed edge from… Read More
Given an array of strings arr[] of length N, the task is to sort the strings in Lexicographical order. Examples: Input: arr[] = {“batman”, “bat”,… Read More
Given an array A[] of size N, the task is to find the total number of positions in all the subarrays such that the value… Read More
Given an array arr[] of size N that contains -1 and all positive integers, the task is to modify the array and print the final… Read More
Given an array of positive integers arr[] of length N and a query array query[] of length M, the task is to find the maximum… Read More
Given an array A[] of N positive integers and 3 integers X, Y, and Z, the task is to check if there exist 4 indices… Read More
These are the special type of recursive functions, where the last statement executed inside the function is the call to the function itself. Advantages of… Read More
Given an array B[] of length N, the task is to print an array A[] such that for every ith element B[i] is gcd of… Read More
Given a binary string S, the task is to count the substrings having the number of 0s and 1s in the ratio of X :… Read More
Given two arrays A[] and B[] of length N and M respectively and a prime number X, the task is to find the number of… Read More
Given an array A[] of size N, the task is to check whether the sequence can be made strictly increasing by performing the following operation… Read More
Given a 2-D array A[][] of size N×3, where each element of the array consists of {x, y, r}, where x and y are coordinates… Read More