LeetCode solutions

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

Read the problem on LeetCode View on GitHub

JavaScript

Accepted on LeetCode — runtime 0ms, memory 56.4MB, accepted 2025-12-29.

javascript
/**
 * @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;
                           };

Source