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

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
兴国县| 普定县| 平潭县| 乌拉特中旗| 江西省| 青阳县| 丰顺县| 无为县| 法库县| 通榆县| 瓦房店市| 三河市| 南乐县| 海门市| 石景山区| 孝感市| 阿尔山市| 张掖市| 河源市| 苗栗县| 田东县| 磐石市| 桓仁| 西峡县| 侯马市| 德格县| 岳池县| 定安县| 资溪县| 玉树县| 宣恩县| 竹北市| 上饶县| 额敏县| 苍山县| 甘孜县| 广昌县| 西峡县| 罗源县| 乾安县| 邹平县|