## Find the lexicographically smallest sequence which can be formed by re-arranging elements of second array

Given two arrays A and B of N integers. Reorder the elements of B in itself in such a way that the sequence formed by… Read More »

- Check if words are sorted according to new order of alphabets
- Lexicographically largest sub-sequence of the given string
- Print a number as string of 'A' and 'B' in lexicographic order
- Check if string can be made lexicographically smaller by reversing any substring
- Reorder the position of the words in alphabetical order
- Make lexicographically smallest palindrome by substituting missing characters
- Find the lexicographically smallest sequence which can be formed by re-arranging elements of second array
- Lexicographically Smallest Permutation of length N such that for exactly K indices, a[i] > a[i] + 1
- Queries to answer the X-th smallest sub-string lexicographically
- Implementing next_permutation() in Java with Examples

Given two arrays A and B of N integers. Reorder the elements of B in itself in such a way that the sequence formed by… Read More »

Given a string str some of whose characters are missing and are represented by a ‘*’. The task is to substitute the missing characters so… Read More »

Given a string str and Q queries. Every query consists of a number X, the task is to print the Xth lexicographically smallest sub-string of… Read More »

Given an array arr[] of strings, the task is to reorder the strings lexicographically and print their positions in the original list. Examples: Input: arr[]… Read More »

Given a string S, the task is to check if we can make the string lexicographically smaller by reversing any sub-string of the given string.… Read More »

Given an array or string, the task is to find the next lexicographically greater permutation of it in Java. Examples: Input: string = “gfg” Output:… Read More »

Given a number N, the task is to print the string of ‘A’ and ‘B’ corresponding to that number. If we represent all numbers as… Read More »

Given a string str containing lowercase characters, the task is to find the lexicographically largest sub-sequence of str. Examples: Input: str = “abc” Output: c… Read More »

Given a sequence of Words and the Order of the alphabet. The order of the alphabet is some permutation of lowercase letters. The task is… Read More »

Given two integers N and K, the task is to generate a permutation of N numbers (Every number from 1 to N occurs exactly once)… Read More »

Given an integer N. The task is to find the lexicographically smallest permutation of integer of the form: 12345…N such that no digit occurs at… Read More »

Given a string str, the task is to find the lexicographically smallest string that can be formed by removing at most one character from the… Read More »

Given a string S. The task is to print the K-th lexicographically smallest one among the different substrings of s. A substring of s is… Read More »

Given a string consisting of only 0’s and 1’s. Now you are given N non-intersecting ranges L, R ( L <= R), more specifically [L1,… Read More »

Given a m x n matrix of positive integers. The task is to find the number of paths from the top left of the matrix… Read More »