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
numFriends
friends. There are multiple rounds in the game, where in each round:
word
is split intonumFriends
non-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
a
is lexicographically smaller than a stringb
if in the first position wherea
andb
differ, stringa
has 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) { |