2916. Check if it is Possible to Split Array
My accepted Python solution to LeetCode problem 2916, Check if it is Possible to Split Array, running in 0ms.
- Difficulty: Medium
- Python
- Runtime 0ms
- Memory 17.2MB
- 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.
Python
Accepted on LeetCode — runtime 0ms, memory 17.2MB, accepted 2026-01-01.
class Solution:
def canSplitArray(self, nums: List[int], m: int) -> bool:
n = len(nums)
# If array has 2 or fewer elements, always possible
if n <= 2:
return True
# We need at least one pair of adjacent elements with sum >= m
# Because we can always work around that pair
for i in range(n - 1):
if nums[i] + nums[i + 1] >= m:
return True
return False