less than 1 minute read

Given a list of integers nums, return whether you can partition the list into two non-empty sublists such that every number in the left sublist is strictly less than every number in the right sublist.

Constraints

  • n ≤ 100,000 where n is the length of nums.

https://binarysearch.com/problems/Split-List

Examples

Example 1

Input

  • nums = [5, 3, 2, 7, 9]

Output

  • answer = True

Explanation

We can split the list into left = [5, 3, 2] and right = [7, 9]

Solution

Categories:

Updated:

Leave a comment