Gavin Kistner wrote: > On Nov 7, 8:12 am, Johnson Wang <99... / 163.com> wrote: >> file. >> Definition > > This smells like a homework problem, so roughly: > Scan the string for groups of consecutive clusters. > Sort the clusters by length. > Iterate through the sorted group adding up the sizes and incrementing > a counter until you reach or exceed your goal. ========================= In fact,this is not a homework but a test question by Topcoder. I am a student at the same time a ruby learner.I have solved this problem with Java language.`Cause i am a newbie to Ruby,so i don`t know how to do it.So here i am and ask for help. Its not a homework,definitely. ^^ If u r Java developer,of course u know how to solve this problem.btw,it`s more convenient if u use Jakarta Commons lib package.(commons-lang-2.3.jar) Tks for your answer. -- Posted via http://www.ruby-forum.com/.