STRING
Coding Questions
String Permutations
Given a string S, your task is to print all permutations of a given string.
Input: Output:
abc abc acb bac bca cab cba
Longest Palindromic Substring
Given a string S, your task is to print the longest palindromic
substring in S.
Input: Output:
babad bab
Recursively Remove All Adjacent
Duplicates
Given a string S, your task is to remove all its adjacent duplicate
characters recursively.
Input: Output:
accdaab adb
Check if string is rotated by 2 places
Given two strings S1 and S2, your task is to check if a string can be
obtained by rotating another string by two places
Input: Output:
hellostring true
llostringhe
Anagram Strings
Given two strings S1 and S2, your task is to check whether both are
anagrams.
Two strings are said to be anagrams if we can generate a string by
rearranging the characters of another string.
Input: Output:
abcd true
cadb
K-Anagram Strings
Given two strings S1 and S2 of lowercase alphabets and an integer
K, your task is to check whether both the strings are K-Anagrams of
each other or not.
Two strings are called K-Anagrams if both of the below conditions
are true.
1. Both have same number of characters.
2. Two strings can become anagram by changing at most K
characters in a string.
Input: Output:
apple true
apled
2
Longest Distinct Characters
Given a string S of lowercase alphabets, nd the length of the
longest substring without repeating characters.
Input: Output:
ababcabcd 4
fi
Number to Words
Given a long integer N, the task is to convert the given number into
words in International Number System.
Input:
1234567
Output:
one million two hundred thirty four thousand ve hundred sixty seven
fi