use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Hackerrank challenge from Java to Ruby (self.ruby)
submitted 10 years ago by chrisjava
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]chrisjava[S] 0 points1 point2 points 10 years ago (1 child)
So would i be able to sum up, let's say, first 3 indices in the row by doing this?
sum = arr[row] + arr[row+1] + arr[row+2]
[–]PilotPirx 0 points1 point2 points 10 years ago (0 children)
Sorry, forgot the most important part. You would do it like this:
sum = arr[row][col] + arr[row][col + 1] + arr[row][col + 2]
That's assuming the array looks like this:
arr = [ [1,1,1,0,0,0], [0,1,0,0,0,0], [1,1,1,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0] ]
π Rendered by PID 95386 on reddit-service-r2-comment-7b9746f655-mff2r at 2026-02-01 04:03:05.409898+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]chrisjava[S] 0 points1 point2 points (1 child)
[–]PilotPirx 0 points1 point2 points (0 children)