The find_index is an inbuilt method in Ruby returns the index position of the given number. If the element is present more than once, the first occurrence is returned. If the element is not present, then nil is returned.
Parameters: The function needs an element which is to be searched in matrix mat1.
Return Value: It returns the row number and column number where the element is.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.