class Solution: def largestUniqueNumber(self, A: List[int]) -> int: dic = {} for i in A: if i not in dic: dic[i] = 1 else: dic[i] += 1 maxnum = -1 for key in dic.keys(): if dic[key] == 1: maxnum = max(maxnum, key) return maxnum 分类: LeetCode 标签: Arra...
➤博客园地址:山青咏芝(https://www.cnblogs.com/strengthen/) ➤GitHub地址:https://github.com/strengthen/LeetCode ➤原文地址:https://www.cnblogs.com/strengthen/p/11258418.html ➤如果链接不是山青咏芝的博客园地址,则可能是爬取作者的文章。 ➤原文已修改更新!强烈建议点击原文地址阅读!支持作者!
1133-Largest-Unique-Number/cpp-1133 CMakeLists.txt main.cpp main2.cpp 1134-Armstrong-Number 1135-Connecting-Cities-With-Minimum-Cost 1136-Parallel-Courses 1140-Stone-Game-II .gitignore qrcode.png readme.mdBreadcrumbs Play-Leetcode /1133-Largest-Unique-Number / cpp-1133...
CodeTestcase Test Result Test Result 764. Largest Plus Sign Medium Topics Companies Hint You are given an integer n. You have an n x n binary grid grid with all values initially 1's except for some indices given in the array mines. The ith element of the array mines is defined as...
Leetcode Solutions (0x6A73). Contribute to waffle87/leetcode development by creating an account on GitHub.
1. 2. 3. Note: nums will have a length in the range [1, 50]. Every nums[i] will be an integer in the range [0, 99]. Intuition and Algorithm Scan through the array to find the unique largest element m, keeping track of it’s index maxIndex. ...
Leetcode之K-diff Pairs in an Array 问题 问题描述: Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numb......
package leetcode func largestPerimeter(A []int) int { if len(A) < 3 { return 0 } quickSort164(A, 0, len(A)-1) for i := len(A) - 1; i >= 2; i-- { if (A[i]+A[i-1] > A[i-2]) && (A[i]+A[i-2] > A[i-1]) && (A[i-2]+A[i-1] > A[i]) { retu...
Leetcode之K-diff Pairs in an Array 问题 问题描述: Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numb... ...
简单题。先扫描一遍找到最大值和下标。再扫描一遍检查最大值是否是其他数字的两倍。 代码# Go packageleetcodefuncdominantIndex(nums[]int)int{maxNum,flag,index:=0,false,0fori,v:=rangenums{ifv>maxNum{maxNum=v index=i}}for_,v:=rangenums{ifv!=maxNum&&2*v>maxNum{flag=true}}ifflag{return-...