Given an array A and positive integer K. The task is to find maximum number of elements for which the absolute difference of any of… Read More
Tag Archives: Constructive Algorithms
Given a string str and an integer K, the task is to check whether the given string is K-periodic. A string is k-periodic if the… Read More
Given four integers a, b, c and d which signifies the number of four types of brackets. “((“ “()” “)(“ “))” The task is to… Read More
Given an array arr[] of binary strings, the task is to calculate the bitwise OR of all of these strings and print the resultant string.Examples: … Read More
Given a string S of length N. The task is to find the minimum number of steps required on strings, so that it has exactly… Read More
Given an array arr[] of positive integers and an integer x, the task is to minimize the sum of elements of the array after performing… Read More
Given an N*N matrix containing only 0s and 1s, the task is to count the number of submatrices containing all 1s. Examples: Input : arr[][]… Read More
Given an array A containing N elements (N is divisible by 3), the task is to split the numbers into groups of 3, let the… Read More
Given two strings A and B of equal lengths, the task is to find an index i such that A[0…i] and B[i+1…n-1] give a palindrome… Read More
Given two strings S1 and S2, you are allowed only to change a character at any position to any vowel if it is a vowel… Read More
Given two integers A and B, the task is to generate and print a string str such that: str must only contain the characters ‘a’… Read More
Given a binary tree with N nodes, in which each node value represents the number of candies present at that node, and there are N… Read More
Given two string A and B which represents two integers, the task is to print the maximized value of A after replacing 0 or more… Read More
Given a string str and an integer k. The task is to count the occurrences of sub-strings of length k that consist of the same… Read More