diff --git a/LeetCode/0274_H_Index.py b/LeetCode/0274_H_Index.py new file mode 100644 index 0000000..086042b --- /dev/null +++ b/LeetCode/0274_H_Index.py @@ -0,0 +1,11 @@ +class Solution: + def hIndex(self, citations: List[int]) -> int: + citations.sort() + n = len(citations) + if n==0: + return 0 + if set(citations) == {0}: + return 0 + for i in range(n): + if n-i<=citations[i]: + return n-i \ No newline at end of file