Given a string str of size N and two integers M and K (N is divisible by M), the task is to find the Kth… Read More

# Tag Archives: lexicographic-ordering

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

Given a binary string s of length N, the task is to find the lexicographically smallest string using infinite number of swaps between 0’s and… Read More

Given three strings, ‘X‘, ‘Y‘ and ‘Z‘, the task is to count the number of subsequences of ‘X‘ which is lexicographically greater than or equal… Read More

Given a string S and an integer K, the task is to find the lexicographically smallest string possible after reversing any substring of any length… Read More

Given a sentence S and a string B having distinct characters, find a string by joining the words of S according to given conditions:- Choose… Read More

Given two integers N and K, the task is to form a string of size N using the first K characters of the alphabet following… Read More

Given a string str, consisting of lower case English alphabets and digits(0-9), the task is to print all possible strings in lexicographic order that can… Read More

Given a string S of N characters, the task is to find the smallest lexicographical string after performing each of the following operations N times… Read More

Given a string Str of N characters and two strings S1 and S2 of equal length where S1[i] and S2[i] are related to each other,… Read More

Given a string str of N characters, the task is to find the lexicographically smallest string that can be formed by concatenating any prefix and… Read More

Given two strings A and B having lower case English alphabets, the task is to find the number of operations required to convert string A… Read More

Given a string s, the task is to find the lexicographically smallest string of minimum characters that do not exist as a substring in S.… Read More