Algorithms/Data Structures — [Problem Solving]
There is a Specific Need for Changes in a List of Usernames. In a given List of Usernames — For Each Username — If the Username can be Modified and Moved Ahead in a Dictionary. The Allowed Modification is that Alphabets can change Positions in the Given Username.
Example
usernames[] = {“Aba”, “Cat”}
“Aba” can be Changed to only “Baa” — Hence, It can Never Find a Place Ahead in the Dictionary. Hence, Output will be “NO”. “Cat” can be Changed to “Act”, “Atc”, “Tca”, “Tac”, “Cta” and Definitely “Act” will Find a Place Before “Cat” in the Dictionary. Hence, Output will be “YES”.
[Function Description]
Complete the function possibleChanges in the Editor Below.
**_possibleChanges _**has the Following Parameters:
String usernames[n]: An Array of User Names
Returns String[n]: An Array with “YES” or “NO” Based on Feasibility
(Actual Question Says String Array, But Signature is List of Strings)
…
#algorithms #core java #data structures #problem solving #mathematical programming #java program #iq #complexity metrics #competitive #hacker rank