3403. Find the Lexicographically Largest String From the Box I
You are given a string
word, and an integernumFriends.Alice is organizing a game for her
numFriendsfriends. There are multiple rounds in the game, where in each round:
wordis split intonumFriendsnon-empty strings, such that no previous round has had the exact same split.- All the split words are put into a box.
Find the lexicographically largest string from the box after all the rounds are finished.
A string
ais lexicographically smaller than a stringbif in the first position whereaandbdiffer, stringahas a letter that appears earlier in the alphabet than the corresponding letter inb.
If the firstmin(a.length, b.length)characters do not differ, then the shorter string is the lexicographically smaller one.
1 | vector<int> SA(string& s) { |