3324. Split the Array
My accepted JavaScript solution to LeetCode problem 3324, Split the Array, running in 0ms.
- Difficulty: Easy
- JavaScript
- Runtime 0ms
- Memory 56.4MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
JavaScript
Accepted on LeetCode — runtime 0ms, memory 56.4MB, accepted 2025-12-29.
/**
* @param {number[]} nums
* @return {boolean}
*/
var isPossibleToSplit = function(nums) {
const count = new Array(101).fill(0);
for (const num of nums) {
if (++count[num] > 2) return false;
}
return true;
};