Created
November 15, 2015 21:49
-
-
Save ewhitebloom/e114e4e86ce51c701ffa to your computer and use it in GitHub Desktop.
Bjorn's Hired.com Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(a,b) | |
whole_squares = 0 | |
(a..b).to_a.each do |i| | |
whole_squares += 1 if Math.sqrt(i) % 1 == 0 | |
end | |
whole_squares | |
end | |
puts solution(4, 17) | |
def sentence_solver(s) | |
sentences = s.split(/[\.?!]/) | |
sentences = sentences.map { |sen| sen.split(' ').length } | |
sentences.max | |
end | |
print sentence_solver("Forget CVs..Save time . x x") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment