We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
ArrayList<Character> s = new ArrayList<Character>();
ArrayList<Character> o = new ArrayList<Character>();
int l = w.length();
for(int i = 0; i < l; i++){
s.add(w.charAt(i));
}
o = (ArrayList<Character>)s.clone();
Collections.sort(s, Collections.reverseOrder());
if(o.equals(s)){
return "no answer";
}
Then solve using lexicographical permutation algorithm
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bigger is Greater
You are viewing a single comment's thread. Return to all comments →
Find no answer without solving:
Then solve using lexicographical permutation algorithm