201. Help the Dog Find Its Bone

Easy · Array

Rex the dog hid a bone somewhere in a list of garden spots. Help Rex find which index the bone is at!

Given a list of strings and a target string 'bone', return the index of 'bone'. If not found, return -1.

Examples

Example 1
Input: spots = ["grass","flower","bone","mud"]
Output: 2
Explanation: 'bone' is at index 2
Example 2
Input: spots = ["grass","flower"]
Output: -1
Explanation: No bone found

Constraints