O(n) solution Java


  • 0
    Z

    class Solution {
    public int hIndex(int[] 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.