Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 469 Bytes

Question_3353.md

File metadata and controls

22 lines (18 loc) · 469 Bytes

LeetCode Records - Question 3353 Minimum Total Operations

Attempt 1: Compare the previous numbers

class Solution {
    public int minOperations(int[] nums) {
        int count = 0;

        for (int i = 0; i < nums.length - 1; i++) {
            if (nums[i] != nums[i + 1]) {
                count++;
            }
        }

        return count;
    }
}
  • Runtime: 5 ms (Beats: 100.00%)
  • Memory: 57.13 MB (Beats: 100.00%)