Back to course home
0% completed
Vote For New Content
Test Case Failure
Divyam Rawat
Dec 4, 2025
When nums = [10, 20, 25, 30, 90, 100] and k =10. Shouldn't the output be [[20, 25, 30]], but with the given solution empty list is coming.
I think the loop should be:
for (int i = 0; i < nums.length - 2; i++) { if (nums[i + 2] - nums[i] <= k) { result.add(List.of(nums[i], nums[i + 1], nums[i + 2])); i += 2; } }
1
0
Comments
Comments