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

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

LeetCode 2815. Max Pair Sum in an Array

2023-08-13 12:17 作者:您是打尖兒還是住店呢  | 我要投稿

You are given a?0-indexed?integer array?nums. You have to find the?maximum?sum of a pair of numbers from?nums?such that the maximum?digit?in both numbers are equal.

Return?the maximum sum or?-1?if no such pair exists.

?

Example 1:

Input:?

nums = [51,71,17,24,42]

Output: 88

Explanation:

For i = 1 and j = 2, nums[i] and nums[j] have equal maximum digits with a pair sum of 71 + 17 = 88. For i = 3 and j = 4, nums[i] and nums[j] have equal maximum digits with a pair sum of 24 + 42 = 66. It can be shown that there are no other pairs with equal maximum digits, so the answer is 88.

Example 2:

Input:?

nums = [1,2,3,4]

Output: -1

Explanation: No pair exists in nums with equal maximum digits.

?

Constraints:

  • 2 <= nums.length <= 100

  • 1 <= nums[i] <= 104

下面是代碼:



Runtime:?11 ms, faster than?100.00%?of?Java?online submissions for?Max Pair Sum in an Array.

Memory Usage:?44.3 MB, less than?100.00%?of?Java?online submissions for?Max Pair Sum in an Array.


LeetCode 2815. Max Pair Sum in an Array的評論 (共 條)

分享到微博請遵守國家法律
哈巴河县| 轮台县| 浮梁县| 刚察县| 临泉县| 达州市| 无锡市| 奉新县| 花垣县| 社旗县| 筠连县| 松潘县| 盐源县| 石阡县| 长寿区| 凤凰县| 运城市| 娱乐| 子长县| 陇川县| 镇远县| 会同县| 唐河县| 珲春市| 张北县| 大名县| 咸阳市| 平南县| 浦东新区| 彩票| 惠来县| 海伦市| 新闻| 镇赉县| 广饶县| 宁武县| 册亨县| 定边县| 沙河市| 平乡县| 富裕县|