Search
⌘K

Leetcode 3190. Find Minimum Operations to Make All Elements Divisible by Three

Compute each element's remainder mod 3 and for each add the minimum moves to reach 0 (min(r, 3−r)), which reduces here to counting all elements with remainder 1 or 2 — their count is the minimum number of ±1 operations needed.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late October, 2024

Google

Google

Mid-level

Transform a sequence of numbers into a target sequence using remainder operations with minimum cost

Comments

Your account is free and you can post anonymously if you choose.