Skip to content

Commit 8eafe76

Browse files
committed
exercism 85 Microwave
1 parent 51cdda7 commit 8eafe76

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ solution of many challenges of [Leetcode](https://leetcode.com/), [Exercism](htt
310310
82. [Linked List](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/linked_list.rb)
311311
83. [ISBN Verifier](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/isbn_verifier.rb)
312312
84. [Complex Number](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/complex_number.rb)
313+
85. [Microwave](https://github.com/kumar91gopi/Algorithms-and-Data-Structures-in-Ruby/blob/master/exercism/microwave.rb)
313314

314315
<a name="leetcode"/>
315316

exercism/microwave.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Problem: https://exercism.org/tracks/ruby/exercises/microwave
2+
3+
# Solution
4+
class Microwave
5+
def initialize(input)
6+
debug"#{input.divmod(100)}"
7+
@minutes,@seconds = input<100 ? input.divmod(60) : input.divmod(100)
8+
if @seconds>=60
9+
@minutes+=(@seconds/60)
10+
@seconds%=60
11+
end
12+
end
13+
14+
def timer
15+
sprintf("%02d:%02d", @minutes, @seconds)
16+
end
17+
end

0 commit comments

Comments
 (0)