in reply to GOLF: Input sort list of integers, Output as [356853]
First try is 63 chars.
#!perl -l # 0 1 2 3 4 5 6 6 # 012345678901234567890123456789012345678901234567890123456789012 sub g {printf"%s%d) %d-%d\n",$a&&!$_{$_}&&$\||'',++$a,$_,++$_{$_}for@_ +} g(0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,4,4,4,4,4,5,5,5,5);
:-)
Update: 58 chars.
#!perl -l # 0 1 2 3 4 5 5 # 0123456789012345678901234567890123456789012345678901234567 sub g {printf"%s%d) $_-%d\n",$a&&!$_{$_}?$\:'',++$a,++$_{$_}for@_} g(0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,4,4,4,4,4,5,5,5,5);
Update2: 49 chars.
#!perl -l # 0 1 2 3 4 4 # 0123456789012345678901234567890123456789012345678 sub g {print$a&&!$_{$_}?$\:'',++$a,") $_-",++$_{$_}for@_} g(0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,4,4,4,4,4,5,5,5,5);
And none of my solutions screw up any special global vars. :-) ($a doesnt count IMo becuase this routine wont be called from within a sort call.)
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
|---|