Quantcast
Channel: Squirrel Hacker » Code Golf
Browsing all 2 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Code Golf – Home On The Range

Home On The Range It’s as simple as “1 2 3 5 6 8” => “1-3, 5-6, 8.” The Problem It’s difficult to spot what’s missing in a long list of numbers if they are just listed one after the other. You can...

View Article



Image may be NSFW.
Clik here to view.

The answer in Ruby (so far)

a = [1,2,3,5,7,8,9,10,12,13,19,200,900,901,902,903,904,905,1000] l = a[0] f = a[0] z = a.length i = 0 s = "" until i == z if (a[i]+1 == a[i+1]) l = a[i+1] end if (a[i]+1 != a[i+1]) if f == l s =...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images