Skip to content

Commit 5df8bf2

Browse files
committed
exercism 61
1 parent d3b45c8 commit 5df8bf2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ solution of many challenges of [Leetcode](https://leetcode.com/), [Exercism](htt
278278
58. [Proverb](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/proverb.rb)
279279
59. [Palindrome Products](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/palindrome_products.rb)
280280
60. [Parallel Letter Frequency](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/parallel_letter_frequency.rb)
281+
61. [Bob](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/bob.rb)
281282

282283
<a name="leetcode"/>
283284

Diff for: exercism/bob.rb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#Problem: https://exercism.org/tracks/ruby/exercises/bob
2+
3+
#Solution
4+
class Bob
5+
def self.hey(remark)
6+
remark = remark.strip
7+
is_yelling = false
8+
is_yelling = remark.upcase ==remark unless remark.scan(/[a-zA-z]/).empty?
9+
is_question = remark.end_with?("?")
10+
return "Fine. Be that way!" if remark == ""
11+
return "Calm down, I know what I'm doing!" if is_yelling and is_question
12+
return "Whoa, chill out!" if is_yelling
13+
return "Sure." if is_question
14+
"Whatever."
15+
end
16+
end

0 commit comments

Comments
 (0)