Given a character array, str[] of consisting of N lowercase alphabets, and an integer array, arr[] consisting of numbers in the range [0, N –… Read More

# Tag Archives: lexicographic-ordering

Given a binary string S, the task is to convert the given string S to its lexicographic maximum form by reversing substrings having an even… Read More

Given three integers N, low and high, the task is to find the lexicographically largest bitonic sequence consisting of N elements lying in the range… Read More

Given a string S consisting of N unique lowercase alphabets and an array arr[] of length N where character S[i] represents the bulb and arr[i]… Read More

Given a string S and a character C, the task is to place a character in the string in such a way that the string… Read More

Given an integer N, the task is to print all numbers from 1 to N ( N < 100000) in words in lexicographical order. Examples… Read More

Given two positive integers N and K, the task is to find the number of K length strings that can be generated from the first… Read More

Given an integer N, the task is to count all possible strings of length N consisting of vowels {a, e, i, o, u} that can… Read More

Given a string S consisting of lowercase alphabets, the task is to find the lexicographically smallest string that can be obtained by removing duplicates from… Read More

Given a string S of length N, the task is to find the lexicographically smallest subsequence of length (N – 1), i.e. by removing a… Read More

Lexicographically smallest permutation of size A having B integers exceeding all preceeding integers

Given two positive integers, A and B, the task is to generate the lexicographically smallest permutation of all integers up to A in which exactly… Read More

Given an integer W and an array a[] of size 26 where ai denotes the cost of using the ith alphabet, the task is to… Read More

Given string str, the task is to find the rank of the given string among all its substrings arranged lexicographically. Examples: Input: S = “enren”Output:… Read More

Given an array arr[] of N strings and a string order which represents the new alphabetical order of the string. The task is to find… Read More

Given an array of strings arr[] of size N, the task is to sort the array of strings in lexicographical order and if while sorting… Read More