Problem 1440. USC Spring 2013 ACM: Snow Cones
This Challenge is to solve the USC Spring 2013 ACM Contest Problem F, Snow Cones.
Summary of Challenge is to Swap the Snow Cones in the minimal number of swaps so the children all have their selected flavor. There are only two flavors, X and O. Input is the string of distributed Cone flavors and a string of desired Cone flavors. Adjacent children may exchange cones but in any one round a child may only swap with one other child.
Determine minimum number of Swap rounds to convert the Distributed to the Desired Cone flavor sequence.
Input: From XXO to OXX Output: 2
Input: From OXOX to XOXO Output: 1
Only two competitors solved this challenge.
A little complex requiring a Matlab 3-Liner solution versus Cao's C solution
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
Reverse the Words (not letters) of a String
436 Solvers
-
Getting the absolute index from a matrix
243 Solvers
-
Find a subset that divides the vector into equal halves
386 Solvers
-
Sum the entries of each column of a matrix which satisfy a logical condition.
158 Solvers
-
Calculate the probability that at least two people in a group share the same birthday.
93 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!