short easy solution


  • 0
    Z
    class Solution {
        public int hIndex(int[] citations) {
            
            Arrays.sort( citations);
            int res = 0;
            
            for( int i=0; i < citations.length; i++){
                if(citations[citations.length - i - 1] > i) res++;
            }
            return res;
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.