3038. Maximum Number of Operations With the Same Score I
1 2 3 4 5 6 7 8 9 10 11 12
| class Solution { public int maxOperations(int[] nums) { int sum = nums[1] + nums[0]; int operations = 1;
for (int i = 3; i < nums.length && nums[i] + nums[i - 1] == sum; i += 2) { operations++; }
return operations; } }
|
References
3038. Maximum Number of Operations With the Same Score I