五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

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

Leetcode 2057. Smallest Index With Equal Value

2023-01-19 12:30 作者:您是打尖兒還是住店呢  | 我要投稿

Given a?0-indexed?integer array?nums, return?the?smallest?index?i?of?nums?such that?i mod 10 == nums[i], or?-1?if such index does not exist.

x mod y?denotes the?remainder?when?x?is divided by?y.

?

Example 1:

Input: nums = [0,1,2]Output: 0Explanation: i=0: 0 mod 10 = 0 == nums[0]. i=1: 1 mod 10 = 1 == nums[1]. i=2: 2 mod 10 = 2 == nums[2]. All indices have i mod 10 == nums[i], so we return the smallest index 0.

Example 2:

Input: nums = [4,3,2,1]Output: 2Explanation: i=0: 0 mod 10 = 0 != nums[0]. i=1: 1 mod 10 = 1 != nums[1]. i=2: 2 mod 10 = 2 == nums[2]. i=3: 3 mod 10 = 3 != nums[3]. 2 is the only index which has i mod 10 == nums[i].

Example 3:

Input: nums = [1,2,3,4,5,6,7,8,9,0]Output: -1Explanation: No index satisfies i mod 10 == nums[i].

用優(yōu)先隊(duì)列的話,就不需要一次排序了。會(huì)更方便的。

Easy題目;

Runtime2 ms

Beats

28.70%

Memory42.6 MB

Beats

48.94%

Click to check the distribution chart


Leetcode 2057. Smallest Index With Equal Value的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
酉阳| 南昌县| 扎囊县| 怀集县| 乌鲁木齐县| 山丹县| 宣武区| 毕节市| 澄迈县| 固安县| 杭州市| 开封县| 中方县| 苍溪县| 攀枝花市| 兴义市| 霞浦县| 静海县| 应用必备| 珠海市| 崇阳县| 临邑县| 浦城县| 九江县| 南通市| 呼和浩特市| 新丰县| 威海市| 兴山县| 东乌珠穆沁旗| 沁阳市| 会昌县| 咸丰县| 岳西县| 霞浦县| 石泉县| 叙永县| 定南县| 岱山县| 新竹市| 西平县|