1394. Find Lucky Integer in an Array
https://leetcode.com/problems/find-lucky-integer-in-an-array
Description
Given an array of integers arr
, a lucky integer is an integer which has a frequency in the array equal to its value.
Return a lucky integer in the array. If there are multiple lucky integers return the largest of them. If there is no lucky integer return -1.
Example 1:
Example 2:
Example 3:
Example 4:
Example 5:
Constraints:
1 <= arr.length <= 500
1 <= arr[i] <= 500
ac
Last updated