{"id":316,"date":"2025-06-30T22:42:37","date_gmt":"2025-06-30T14:42:37","guid":{"rendered":"http:\/\/getzs.online\/?p=316"},"modified":"2025-06-30T22:42:37","modified_gmt":"2025-06-30T14:42:37","slug":"274-h-%e6%8c%87%e6%95%b0","status":"publish","type":"post","link":"https:\/\/hello.getzs.online\/index.php\/2025\/06\/30\/274-h-%e6%8c%87%e6%95%b0\/","title":{"rendered":"274. H \u6307\u6570"},"content":{"rendered":"\n<p><a href=\"https:\/\/leetcode.cn\/problems\/h-index\/\">274. H \u6307\u6570<\/a><\/p>\n\n\n\n<p>\u7ed9\u4f60\u4e00\u4e2a\u6574\u6570\u6570\u7ec4&nbsp;<code>citations<\/code>&nbsp;\uff0c\u5176\u4e2d&nbsp;<code>citations[i]<\/code>&nbsp;\u8868\u793a\u7814\u7a76\u8005\u7684\u7b2c&nbsp;<code>i<\/code>&nbsp;\u7bc7\u8bba\u6587\u88ab\u5f15\u7528\u7684\u6b21\u6570\u3002\u8ba1\u7b97\u5e76\u8fd4\u56de\u8be5\u7814\u7a76\u8005\u7684&nbsp;<strong><code>h<\/code><em>&nbsp;<\/em>\u6307\u6570<\/strong>\u3002<\/p>\n\n\n\n<p>\u6839\u636e\u7ef4\u57fa\u767e\u79d1\u4e0a&nbsp;<a href=\"https:\/\/baike.baidu.com\/item\/h-index\/3991452?fr=aladdin\" target=\"_blank\" rel=\"noreferrer noopener\">h \u6307\u6570\u7684\u5b9a\u4e49<\/a>\uff1a<code>h<\/code>&nbsp;\u4ee3\u8868\u201c\u9ad8\u5f15\u7528\u6b21\u6570\u201d \uff0c\u4e00\u540d\u79d1\u7814\u4eba\u5458\u7684&nbsp;<code>h<\/code><strong>&nbsp;\u6307\u6570&nbsp;<\/strong>\u662f\u6307\u4ed6\uff08\u5979\uff09\u81f3\u5c11\u53d1\u8868\u4e86&nbsp;<code>h<\/code>&nbsp;\u7bc7\u8bba\u6587\uff0c\u5e76\u4e14&nbsp;<strong>\u81f3\u5c11&nbsp;<\/strong>\u6709&nbsp;<code>h<\/code>&nbsp;\u7bc7\u8bba\u6587\u88ab\u5f15\u7528\u6b21\u6570\u5927\u4e8e\u7b49\u4e8e&nbsp;<code>h<\/code>&nbsp;\u3002\u5982\u679c&nbsp;<code>h<\/code><em>&nbsp;<\/em>\u6709\u591a\u79cd\u53ef\u80fd\u7684\u503c\uff0c<strong><code>h<\/code>&nbsp;\u6307\u6570&nbsp;<\/strong>\u662f\u5176\u4e2d\u6700\u5927\u7684\u90a3\u4e2a\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong><code>citations = [3,0,6,1,5]<\/code>\n<strong>\u8f93\u51fa\uff1a<\/strong>3 \n<strong>\u89e3\u91ca\uff1a<\/strong>\u7ed9\u5b9a\u6570\u7ec4\u8868\u793a\u7814\u7a76\u8005\u603b\u5171\u6709 <code>5<\/code> \u7bc7\u8bba\u6587\uff0c\u6bcf\u7bc7\u8bba\u6587\u76f8\u5e94\u7684\u88ab\u5f15\u7528\u4e86 <code>3, 0, 6, 1, 5<\/code> \u6b21\u3002\n&nbsp;    \u7531\u4e8e\u7814\u7a76\u8005\u6709 <code>3 <\/code>\u7bc7\u8bba\u6587\u6bcf\u7bc7 <strong>\u81f3\u5c11 <\/strong>\u88ab\u5f15\u7528\u4e86 <code>3<\/code> \u6b21\uff0c\u5176\u4f59\u4e24\u7bc7\u8bba\u6587\u6bcf\u7bc7\u88ab\u5f15\u7528 <strong>\u4e0d\u591a\u4e8e<\/strong> <code>3<\/code> \u6b21\uff0c\u6240\u4ee5\u5979\u7684 <em>h <\/em>\u6307\u6570\u662f <code>3<\/code>\u3002<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>citations = [1,3,1]\n<strong>\u8f93\u51fa\uff1a<\/strong>1\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>n == citations.length<\/code><\/li>\n\n\n\n<li><code>1 &lt;= n &lt;= 5000<\/code><\/li>\n\n\n\n<li><code>0 &lt;= citations[i] &lt;= 1000<\/code><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>    public int hIndex(int&#91;] citations) {\n        return method2(citations, citations.length);\n    }\n\n    \/**\n     * \u6392\u5e8f\n     * 1 ms\n     * \u590d\u6742\u5ea6O(nlogn)\n     *\/\n    public int method1(int&#91;] citations, int n) {\n        Arrays.sort(citations);\n        for (int i = 0 ; i &lt; n ; i++) {\n            if (citations&#91;i] >= n - i) {\n                return n - i;\n            }\n        }\n        return 0;\n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>274. H \u6307\u6570 \u7ed9\u4f60\u4e00\u4e2a\u6574\u6570\u6570\u7ec4&nbsp;citations&nbsp;\uff0c\u5176\u4e2d&nbsp;citatio [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,11],"tags":[],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-leetcode"],"_links":{"self":[{"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":1,"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/posts\/316\/revisions\/317"}],"wp:attachment":[{"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hello.getzs.online\/index.php\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}