b***y 发帖数: 2799 | 1 ☆─────────────────────────────────────☆
leohawk (leohawk) 于 (Wed Apr 9 16:35:39 2008) 提到:
Partitioning
Given an array of balls, which can be one of two colors (RED or BLUE), write
a function that partitions
the array in-place such that on exit from the function all the balls of the
same color are contiguous.
It does not matter whether the red or blue balls come first. The return
value from the function is the
index of the first ball of the second color. If there is only one color of
balls |
|