Skip to content

RyazanovEvgeniy/PokerEquilibrium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PokerEquilibrium net8.0


Jose set up a circular poker table for his friends so that each of the seats at the table has the same number of poker chips.
But when Jose wasn’t looking, someone rearranged all of the chips so that they are no longer evenly distributed!
Now Jose needs to redistribute the chips so that every seat has the same number before his friends arrive.
But Jose is very meticulous: to ensure that he doesn’t lose any chips in the process, he only moves chips between adjacent seats.
Moreover, he only moves chips one at a time. What is the minimum number of chip moves
Jose will need to make to bring the chips back to equilibrium?
Input:
chips: [1, 5, 9, 10, 5]
Expected Output:
12
Test 2
Input:
chips: [1, 2, 3]
Expected Output:
1
Test 3
Input:
chips: [0, 1, 1, 1, 1, 1, 1, 1, 1, 2]
Expected Output:
1