C++ implementation, so easy!!!!!!


  • -17
    T
    class Solution {
    public:
        int hIndex(vector<int>& citations) {
            int n = citations.size();
            if(n==0)
                return 0;
            for(int h=n; h>0; h--)
            {
                if(citations[n-h]>=h)
                    return h;
            }
            return 0;
        }
    };

  • 4

    还so easy!!!!!!
    你TM把中国人的平均智商都拉低了!


Log in to reply
 

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