我想打印內部parenteses與重複號的數組,怎麼什麼想法?Java的如何打印數組內的重複數「()」
陣列:
{2,4,5,5,5,7,1,1,4}
我需要打印爲:
24(555)7(11)4
這裏是我的僞代碼:
boolean inRun = false;
for loop;
if (inRun);
if values[i] != the preceding value, print ")";
inRun = false;
if(!inRun)
if values[i] = the following value, print "("
inRun = true;
System.out.print([i])
if inRun, print ")"
這聞起來像家庭作業.. – Bartzilla 2011-03-20 17:29:52
是固定的任何給定的輸入數字的輸出格式? – Deepak 2011-03-20 17:31:37
我們在這裏不是完全做你的(家庭)對你的工作,但我們來這裏是爲了幫助你找出你被困在的問題。發佈您迄今爲止嘗試過的任何代碼。顯示你已經做出了一些努力。 – 2011-03-20 17:33:38