First line contains an integer T (between 1 and 100) which stands for the number of testcases. The next T lines contain the details for each testcase. Each line contains two space seperated non-null strings with string length between 1 and 100
Answers
Answer:
An article containing recent Directi programming round questions in my campus placements and also those in my friends’ colleges.
1) You are given a string S. Each character of S is either ‘a’, or ‘b’. You wish to reverse exactly one sub-string of S such that the new string is lexicographically smaller than all the other strings that you can get by reversing exactly one sub-string.
For example, given ‘abab’, you may choose to reverse the substring ‘ab’ that starts from index 2 (0-based). This gives you the string ‘abba’. But, if you choose the reverse the substring ‘ba’ starting from index 1, you will get ‘aabb’. There is no way of getting a smaller string, hence reversing the substring in the range [1, 2] is optimal.
Answer:
First line contains an integer T (between 1 and 100) which stands for the number of testcases. The next T lines contain the details for each testcase. Each line contains two space seperated non-null strings with string length between 1 and 100
it's a article