Skip to content

Latest commit

 

History

History

linear_search

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Linear search

Instructions

Given list of strings and a string return index of th value in the list or -1 if value was not found.

Challenge | Solution

Limitations

Don't use any Ruby build-in methods that are directly returning index of element like index / find_index, etc.

Examples

get_index(%(A B C), 'A') # 0

get_index(%(A B C), 'B') # 1

get_index(%(A B C), 'D') # -1