Skip to content

Practice Find the Lexicographically Largest String From the Box I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3403
LeetCode Problem

Find the Lexicographically Largest String From the Box I

Problem Statement

Consider every distinct way to split word into exactly numFriends nonempty contiguous parts. Collect every part from every such split. Return the lexicographically largest string in that collection.

Source: Find the Lexicographically Largest String From the Box I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
word = "dbca", numFriends = 2
Output
"dbc"

# Example 2

Input
word = "gggg", numFriends = 4
Output
"g"

Constraints

1 <= word.length <= 5 * 10^3
word consists only of lowercase English letters.
1 <= numFriends <= word.length

Related LeetCode Problems

Practice more problems similar to Find the Lexicographically Largest String From the Box I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.