Leetcode in Java && Oracle
422 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-11-03_17-41-51.png
27.6 KB
#N1217. Minimum Cost to Move Chips to The Same Position

click➡️ problem link

#solution
class Solution {
public int minCostToMoveChips(int[] position) {
int[] helper=new int[2];

for(int chip:position)
helper[chip%2]++;

return Math.min(helper[0], helper[1]);
}
}