-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1217.py
More file actions
24 lines (24 loc) · 1.47 KB
/
1217.py
File metadata and controls
24 lines (24 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Solution:
def minCostToMoveChips(self, chips):
even = 0
odd = 0
for i in chips:
if i%2 == 0:
even += 1
else:
odd += 1
if even < odd:
return even
else:
return odd
s = Solution()
a = [2,2,2,3,3]
b = [1,2,3]
c = [2,3,3]
d = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
e = [873948575,474533627,452177083,791427808,697644123,302152894,541588572,558363886,548407188,471598140,770732235,301998733,325834022,556410479,203748400,435937358,60324793,705857413,873717995,625916506,625719859,231887650,700921520,761252154,156288291,495276617,286840694,336778205,644267123,247271202,742626048,992193925,363888842,509849880,662416263,255801216,95223395,874824616,81916406,987333781,149303171,693221574,629064170,916073939,816404459,123499148,793873766,321285807,48189630,328285582,125618638,849763739,217318109,892230315,703223138,121709772,953047617,148391378,895771954,208978761,414661066,503181327,381389664,190549842,941391859,480846286,993408450,713278346,847890986,122795238,604802113,313898525,686011611,360523783,649365910,791129806,711689749,172358016,321515694,586014973,357988079,291689585,328317319,922531774,973305216,110284608,733648583,225348216,781833709,963638701,91510661,532528005]
print(s.minCostToMoveChips(a))
print(s.minCostToMoveChips(b))
print(s.minCostToMoveChips(c))
print(s.minCostToMoveChips(d))
print(s.minCostToMoveChips(e))