1394. Find Lucky Integer in an Array
Easy
Given an array of integers arr
, a lucky integer is an integer that has a frequency in the array equal to its value.
Return the largest lucky integer in the array. If there is no lucky integer return -1
.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= arr.length <= 500
1 <= arr[i] <= 500
解題
Runtime: 6 ms, faster than 78.43%
Memory Usage: 3 MB, less than 98.04%
Last updated