Given an array A of size N. A boolean array B consisting of N-1 elements indicates that if B[i] is 1 then A[i] can be swapped with A[i+1]. Find if A can Read more →
Data Structures
5 postsGiven an array of N integers, where each value represents the volume of the cloud. The task is to choose the two highest volume clouds from an array and smash them together. Read more →
Given a string s, the task is to print all permutations of a string that are in ascending order, i.e., their characters are in ascending order. Examples: Input: Cplusplus Output: Cllppssuu Out Read more →
Given an array arr[] of 2N integers, where N is any positive integer. The task is to divide the array into N pairs such that the pair sum minimizes the maximum sum Read more →
Given a list of n integers and consider another list which has n-1 “<” or “>” operators. Your task is to form a valid sequence by rearranging the initial list such that Read more →
We all must have encountered the vertical Traversal of the Binary Tree problem. In this version of the problem we will see how we can perform the traversal vertically while keeping in Read more →
Find maximum sum of array A, where k swap can be possible between array A and B. Size of array A and B is N. Examples: Input : N = 5 k Read more →
Given an unsorted array of integers which may contain repeated elements, sort the elements in ascending order of sum of its occurrence and print only distinct elements. If there exist more than Read more →
Given two array A[] and B[] of length N, the task is the find the minimum cost to make array A[] a permutation of array B[], where the cost of incrementing or Read more →
Given an array of n integers, you need to find minimum number of below operation such that arrays becomes sorted in non-decreasing order. In a single operation you can rotate the given Read more →