Given a string str of length n. The task is to find a lexicographic largest string where you are allowed to shift one character from… Read More
Tag Archives: lexicographic-ordering
Given a string s of length N consisting of digits from 0 to 9. Find the lexicographically minimum sequence that can be obtained from given… Read More
You are given an array of Email IDs, the task is to return the lexicographically first email ID of every single domain. Examples: Input: Emails[]… Read More
Given an integer N, the task is to print all numbers up to N in Lexicographical order. Examples: Input: N = 20Output: 1 10 11… Read More
Given a string S consisting of only lowercase characters, the task is to find the lexicographically smallest string after removing exactly K characters from the… Read More
Consider two arrays arr1[] and arr2[] each of size N such that arr1[] contains all odd numbers between 1 to 2*N and arr2[] contains all… Read More
Given a string S, the task is to find out the length of the smallest substring of S that needs to be rearranged so that… Read More
Given two strings str1 and str2 containing lowercase letters. The task is to convert the given string str3 into lexicographically smallest and largest string that… Read More
Given an array A[] of N integers, the task is to find the lexicographically smallest subsequence of the array by deleting all the occurrences of… Read More
Given an array A[] of size N, find the permutation of array A such that the array B[] which is formed by taking the GCD… Read More
Given two strings X and Y of lowercase letters, of length N and M respectively, the task is to build another string Z by performing… Read More
Given a string S of size N, having lowercase alphabets, the task is to find the lexicographically minimum string after moving a subsequence to the… Read More
Given string str of size N and two integers M and K (N is divisible by M), the task is to find the Kth non-overlapping… Read More
Given a 2D array arr[] having N rows of variable size, the task is to sort the array in lexicographical order i.e., sort each row… Read More
Given two integers N and M, the task is to find the Mth lexicographically smallest binary string (have only characters 1 and 0) of length… Read More