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
-
Notifications
You must be signed in to change notification settings - Fork 0
RyazanovEvgeniy/PokerEquilibrium
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description or website provided.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published