#2811

Check if it is Possible to Split Array

expert · 1090 · lc medium +32 · 34.4% accepted · 530 likes · top 12%

Description

An array nums of length n and an integer m are given. Determine whether nums can be fully split into n singleton arrays.

An array is good when:

- It has length one, or

- The sum of its elements is at least m.

In each step, pick any existing good array of length at least two and split it into two subarrays, provided both halves are also good.

Return true if the full split into singletons is achievable, otherwise return false.

Code

1
2
3