最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

leetcode 1394. Find Lucky Integer in an Array

2022-02-10 18:26 作者:您是打尖兒還是住店呢  | 我要投稿

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:

Input: arr = [2,2,3,4]Output: 2Explanation: The only lucky number in the array is 2 because frequency[2] == 2.

Example 2:

Input: arr = [1,2,2,3,3,3]Output: 3Explanation: 1, 2 and 3 are all lucky numbers, return the largest of them.

Example 3:

Input: arr = [2,2,2,3,3]Output: -1Explanation: There are no lucky numbers in the array.




Runtime:?10 ms, faster than?13.49%?of?Java?online submissions for?Find Lucky Integer in an Array.

Memory Usage:?43.6 MB, less than?11.76%?of?Java?online submissions for?Find Lucky Integer in an Array.


leetcode 1394. Find Lucky Integer in an Array的評論 (共 條)

分享到微博請遵守國家法律
钦州市| 沧州市| 普兰县| 田东县| 贞丰县| 宜章县| 中山市| 浠水县| 攀枝花市| 弋阳县| 鹤山市| 舞钢市| 分宜县| 樟树市| 濮阳县| 吴川市| 香港 | 千阳县| 罗江县| 温州市| 大新县| 漯河市| 三台县| 华容县| 元氏县| 明光市| 万盛区| 遂川县| 集安市| 乾安县| 新蔡县| 贵阳市| 凤山县| 龙陵县| 环江| 乃东县| 无极县| 仁寿县| 宝应县| 瑞丽市| 保靖县|