Given an array of integers and a target value, determine whether the target element exists in the array. Return true if the element is present, otherwise return false.
Example 1
Input: arr = [1,3,5,7,9], target = 5
Output: true
Explanation: The element 5 is present in the array, so the result is true.
Example 2
Input: arr = [2,4,6,8], target = 3
Output: false
Explanation: The element 3 does not exist in the array, so the result is false.
Example 3
Input: arr = [], target = 1
Output: false
Explanation: The array is empty, so no element exists.
Sign in to write, run, and submit your solution against the full test suite.