[Ruby] [ruby] Drill output

less than 1 minute read

Content

image.png

Implementation

image.png

Comment

With input.each_with_index, the numbers stored in input are taken out as num one by one, and numbered in the order in which they are taken out.

And when the retrieved num is the same as target_num, it outputs the result of what number it is included in, so considering that the array starts from 0th, it is set to #{index + 1}.

Tags:

Updated: