Skip to content
the poor coder

Hackerrank Ruby Control Structures - Until Solution

Poor Man
Published
Updated
Reading time
1 min read

This challenge has a beautiful one-liner answer.

"A hacker practices on HackerRank until getting to a rating of O(1) read as (Oh-one)"

Call the method coder.practice until coder.oh_one? becomes true.

Use the until control structure.

until is the logical equivalent of while not.

Hint

Text
while not <condition>
    <code>
end

or

Text
until <condition>
    <code>
end

or the beautiful one-liner

Text
<code> until <condition>  

Solution in ruby#

Approach 1.

Python
until coder.oh_one? do coder.practice end

Approach 2.

Python
# Enter your code here. Read input from STDIN. Print output to STDOUT
coder.practice until coder.oh_one?

Approach 3.

Python
# Enter your code here. Read input from STDIN. Print output to STDOUT
coder.practice until coder.oh_one?

Keep going

ESC