Find Lucky Integer
A value is lucky if the number of times it appears in arr equals the value itself. Return the largest lucky value, or -1 if there is none.
Example 1
arr [2,2,3,4]
returns 2
2 appears twice, so it is lucky.
Example 2
arr [1,2,2,3,3,3]
returns 3
1, 2 and 3 are all lucky; the largest is 3.
Constraints
1 <= len(arr) <= 401 <= arr[i] <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.