3403. Find the Lexicographically Largest String From the Box I
Medium
30 Points
Two Pointers
String
Enumeration
You are given a string word, and an integer numFriends.
Alice is organizing a game for her numFriends friends. There are multiple rounds in the game, where in each round:
Find the lexicographically largest string from the box after all the rounds are finished.
Examples
Example 1
Input: word = "dbca", numFriends = 2
Output: "dbc"
Explanation:
All possible splits are:
Example 2
Input: word = "gggg", numFriends = 4
Output: "g"
Explanation:
The only possible split is: "g" , "g" , "g" , and "g" .
Constraints
1 <= word.length <= 5 * 103
word consists only of lowercase English letters.
1 <= numFriends <= word.length
3403. Find the Lexicographically Largest String From the Box I
Medium
30 Points
Two Pointers
String
Enumeration
You are given a string word, and an integer numFriends.
Alice is organizing a game for her numFriends friends. There are multiple rounds in the game, where in each round:
Find the lexicographically largest string from the box after all the rounds are finished.
Examples
Example 1
Input: word = "dbca", numFriends = 2
Output: "dbc"
Explanation:
All possible splits are:
Example 2
Input: word = "gggg", numFriends = 4
Output: "g"
Explanation:
The only possible split is: "g" , "g" , "g" , and "g" .
Constraints
1 <= word.length <= 5 * 103
word consists only of lowercase English letters.
1 <= numFriends <= word.length
Find the Lexicographically Largest String From the Box I - Practice Coding | SlaveCode