문제 출처: https://leetcode.com/problems/binary-search/
func search(_ nums: [Int], _ target: Int) -> Int {
return nums.contains(target) ? nums.firstIndex(of: target)! : -1
}
func search(_ nums: [Int], _ target: Int) -> Int {
var result = -1
for i in 0..<nums.count {
if nums[i] == target {
result = i
}
}
return result
}