HomeSorting Three GroupsRead solution.1 2 3 4 5 6 7 8 class Solution: def minimumOperations(self, A: List[int]) -> int: a, b, c = 0, 0, 0 for x in A: a += x != 1 b = min(a, b + (x != 2)) c = min(b, c + (x != 3)) return c
Read solution.
1 2 3 4 5 6 7 8
class Solution: def minimumOperations(self, A: List[int]) -> int: a, b, c = 0, 0, 0 for x in A: a += x != 1 b = min(a, b + (x != 2)) c = min(b, c + (x != 3)) return c