diff --git a/README.md b/README.md index f457c9d..3b8daf6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 丁一随想 :link: https://bg6mgd.github.io/blog -### :page_facing_up: [5](https://bg6mgd.github.io/blog/tag.html) +### :page_facing_up: [6](https://bg6mgd.github.io/blog/tag.html) ### :speech_balloon: 1 -### :hibiscus: 775 -### :alarm_clock: 2024-09-14 16:32:17 +### :hibiscus: 1156 +### :alarm_clock: 2024-09-14 19:41:06 ### Powered by :heart: [Gmeek](https://github.com/Meekdai/Gmeek) diff --git "a/backup/\346\265\213\350\257\225\345\206\231\344\273\243\347\240\201.md" "b/backup/\346\265\213\350\257\225\345\206\231\344\273\243\347\240\201.md" new file mode 100644 index 0000000..e2bb692 --- /dev/null +++ "b/backup/\346\265\213\350\257\225\345\206\231\344\273\243\347\240\201.md" @@ -0,0 +1,10 @@ +‘’‘ +class Solution: + def twoSum(self, nums: list[int], target: int) -> list[int]: + hash_map = {} + for i, num in enumerate(nums): + complement = target - num # 计算目标值需要的差值 + if complement in hash_map: # 查找哈希表中是否存在这个差值 + return [hash_map[complement], i] # 找到匹配项,返回两个索引 + hash_map[num] = i # 将当前数字和索引存入哈希表 +’‘’ diff --git a/blogBase.json b/blogBase.json index be0e535..ce84de8 100644 --- a/blogBase.json +++ b/blogBase.json @@ -1 +1 @@ -{"singlePage": [], "startSite": "", "filingNum": "", "onePageListNum": 15, "commentLabelColor": "#006b75", "yearColorList": ["#bc4c00", "#0969da", "#1f883d", "#A333D0"], "i18n": "CN", "themeMode": "manual", "dayTheme": "light", "nightTheme": "dark", "urlMode": "pinyin", "script": "", "style": "", "head": "", "indexScript": "", "indexStyle": "", "bottomText": "", "showPostSource": 1, "iconList": {}, "UTC": 8, "rssSplit": "sentence", "exlink": {}, "needComment": 1, "allHead": "", "title": "\u4e01\u4e00\u968f\u60f3", "subTitle": "\u70b9\u6ef4\u8bb0\u5f55", "avatarUrl": "https://github.githubassets.com/favicons/favicon.svg", "GMEEK_VERSION": "last", "postListJson": {"P3": {"htmlDir": "docs/post/xiu-gai-le-bo-ke-mo-ban-de-pei-zhi-wen-jian-\uff0c-shi-de-bo-ke-wu-fa-zheng-chang-fa-bu.html", "labels": ["\u6280\u672f\u8bb0\u5f55"], "postTitle": "\u4fee\u6539\u4e86\u535a\u5ba2\u6a21\u7248\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f7f\u5f97\u535a\u5ba2\u65e0\u6cd5\u6b63\u5e38\u53d1\u5e03", "postUrl": "post/xiu-gai-le-bo-ke-mo-ban-de-pei-zhi-wen-jian-%EF%BC%8C-shi-de-bo-ke-wu-fa-zheng-chang-fa-bu.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/3", "commentNum": 0, "wordCount": 141, "description": "\u628a\u914d\u7f6e\u6587\u4ef6\u6539\u56de\u53bb\uff0c\u91cd\u65b0\u5199\u4e00\u6bb5\uff0c\u6d4b\u8bd5\u3002", "top": 0, "createdAt": 1726206854, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-13", "dateLabelColor": "#bc4c00"}, "P4": {"htmlDir": "docs/post/ce-shi-biao-qian-xiao-guo.html", "labels": ["\u65e5\u8bb0"], "postTitle": "\u6d4b\u8bd5\u6807\u7b7e\u6548\u679c", "postUrl": "post/ce-shi-biao-qian-xiao-guo.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/4", "commentNum": 1, "wordCount": 14, "description": "\u65b0\u5efa\u4e86\u4e2d\u6587\u6807\u7b7e\uff0c\u6d4b\u8bd5\u662f\u5426\u53ef\u7528\u3002", "top": 0, "createdAt": 1726208846, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-13", "dateLabelColor": "#bc4c00"}, "P5": {"htmlDir": "docs/post/2024-nian-9-yue-13-ri- -jin-tian-kai-shi-xue-xi-shen-du-xue-xi-pytorch.html", "labels": ["\u7f16\u7a0b"], "postTitle": "2024\u5e749\u670813\u65e5 \u4eca\u5929\u5f00\u59cb\u5b66\u4e60\u6df1\u5ea6\u5b66\u4e60pytorch", "postUrl": "post/2024-nian-9-yue-13-ri-%20-jin-tian-kai-shi-xue-xi-shen-du-xue-xi-pytorch.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/5", "commentNum": 0, "wordCount": 251, "description": "\u6628\u665a\u5728github\u6d4f\u89c8\u70ed\u70b9\u4ed3\u5e93\uff0c\u770b\u5230\u4e86\u4e00\u4e2a\u6df1\u5ea6\u5b66\u4e60\u7684\u6559\u7a0b\u3002", "top": 0, "createdAt": 1726232844, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-13", "dateLabelColor": "#bc4c00"}, "P6": {"htmlDir": "docs/post/2024-nian-9-yue-14-ri.html", "labels": ["\u65e5\u8bb0"], "postTitle": "2024\u5e749\u670814\u65e5", "postUrl": "post/2024-nian-9-yue-14-ri.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/6", "commentNum": 0, "wordCount": 15, "description": "\u5929\u6709\u70b9\u51b7\u4e86\uff0c\u65e9\u4e0a\u8d77\u6765\u6709\u70b9\u6d41\u9f3b\u5b50\u3002", "top": 0, "createdAt": 1726271782, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-14", "dateLabelColor": "#bc4c00"}, "P7": {"htmlDir": "docs/post/2024-nian-9-yue-14-ri-zai-lie-biao-zhong-zhao-dao-liang-ge-shu-de-he-deng-yu-mou-ge-shu-\uff0c-shu-chu-zhe-liang-ge-shu-de-suo-yin.html", "labels": ["\u7f16\u7a0b"], "postTitle": "2024\u5e749\u670814\u65e5\u5728\u5217\u8868\u4e2d\u627e\u5230\u4e24\u4e2a\u6570\u7684\u548c\u7b49\u4e8e\u67d0\u4e2a\u6570\uff0c\u8f93\u51fa\u8fd9\u4e24\u4e2a\u6570\u7684\u7d22\u5f15", "postUrl": "post/2024-nian-9-yue-14-ri-zai-lie-biao-zhong-zhao-dao-liang-ge-shu-de-he-deng-yu-mou-ge-shu-%EF%BC%8C-shu-chu-zhe-liang-ge-shu-de-suo-yin.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/7", "commentNum": 0, "wordCount": 354, "description": "class Solution:\r\n def twoSum(self, nums: List[int], target: int) -> List[int]:\r\n hash_map = {}\r\n for i, num in enumerate(nums):\r\n complement = target - num # \u8ba1\u7b97\u76ee\u6807\u503c\u9700\u8981\u7684\u5dee\u503c\r\n if complement in hash_map: # \u67e5\u627e\u54c8\u5e0c\u8868\u4e2d\u662f\u5426\u5b58\u5728\u8fd9\u4e2a\u5dee\u503c\r\n return [hash_map[complement], i] # \u627e\u5230\u5339\u914d\u9879\uff0c\u8fd4\u56de\u4e24\u4e2a\u7d22\u5f15\r\n hash_map[num] = i \u3002", "top": 0, "createdAt": 1726302707, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-14", "dateLabelColor": "#bc4c00"}}, "singeListJson": {}, "labelColorDict": {"\u60f3\u6cd5": "#1166EC", "\u6280\u672f\u8bb0\u5f55": "#bfd4f2", "\u65e5\u5e38\u968f\u60f3": "#b60205", "\u65e5\u8bb0": "#D0D9D0", "\u751f\u6d3b": "#80A2E1", "\u7f16\u7a0b": "#AF77D6"}, "displayTitle": "\u4e01\u4e00\u968f\u60f3", "faviconUrl": "https://github.githubassets.com/favicons/favicon.svg", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "primerCSS": "", "homeUrl": "https://bg6mgd.github.io/blog", "prevUrl": "disabled", "nextUrl": "disabled"} \ No newline at end of file +{"singlePage": [], "startSite": "", "filingNum": "", "onePageListNum": 15, "commentLabelColor": "#006b75", "yearColorList": ["#bc4c00", "#0969da", "#1f883d", "#A333D0"], "i18n": "CN", "themeMode": "manual", "dayTheme": "light", "nightTheme": "dark", "urlMode": "pinyin", "script": "", "style": "", "head": "", "indexScript": "", "indexStyle": "", "bottomText": "", "showPostSource": 1, "iconList": {}, "UTC": 8, "rssSplit": "sentence", "exlink": {}, "needComment": 1, "allHead": "", "title": "\u4e01\u4e00\u968f\u60f3", "subTitle": "\u70b9\u6ef4\u8bb0\u5f55", "avatarUrl": "https://github.githubassets.com/favicons/favicon.svg", "GMEEK_VERSION": "last", "postListJson": {"P3": {"htmlDir": "docs/post/xiu-gai-le-bo-ke-mo-ban-de-pei-zhi-wen-jian-\uff0c-shi-de-bo-ke-wu-fa-zheng-chang-fa-bu.html", "labels": ["\u6280\u672f\u8bb0\u5f55"], "postTitle": "\u4fee\u6539\u4e86\u535a\u5ba2\u6a21\u7248\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f7f\u5f97\u535a\u5ba2\u65e0\u6cd5\u6b63\u5e38\u53d1\u5e03", "postUrl": "post/xiu-gai-le-bo-ke-mo-ban-de-pei-zhi-wen-jian-%EF%BC%8C-shi-de-bo-ke-wu-fa-zheng-chang-fa-bu.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/3", "commentNum": 0, "wordCount": 141, "description": "\u628a\u914d\u7f6e\u6587\u4ef6\u6539\u56de\u53bb\uff0c\u91cd\u65b0\u5199\u4e00\u6bb5\uff0c\u6d4b\u8bd5\u3002", "top": 0, "createdAt": 1726206854, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-13", "dateLabelColor": "#bc4c00"}, "P4": {"htmlDir": "docs/post/ce-shi-biao-qian-xiao-guo.html", "labels": ["\u65e5\u8bb0"], "postTitle": "\u6d4b\u8bd5\u6807\u7b7e\u6548\u679c", "postUrl": "post/ce-shi-biao-qian-xiao-guo.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/4", "commentNum": 1, "wordCount": 14, "description": "\u65b0\u5efa\u4e86\u4e2d\u6587\u6807\u7b7e\uff0c\u6d4b\u8bd5\u662f\u5426\u53ef\u7528\u3002", "top": 0, "createdAt": 1726208846, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-13", "dateLabelColor": "#bc4c00"}, "P5": {"htmlDir": "docs/post/2024-nian-9-yue-13-ri- -jin-tian-kai-shi-xue-xi-shen-du-xue-xi-pytorch.html", "labels": ["\u7f16\u7a0b"], "postTitle": "2024\u5e749\u670813\u65e5 \u4eca\u5929\u5f00\u59cb\u5b66\u4e60\u6df1\u5ea6\u5b66\u4e60pytorch", "postUrl": "post/2024-nian-9-yue-13-ri-%20-jin-tian-kai-shi-xue-xi-shen-du-xue-xi-pytorch.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/5", "commentNum": 0, "wordCount": 251, "description": "\u6628\u665a\u5728github\u6d4f\u89c8\u70ed\u70b9\u4ed3\u5e93\uff0c\u770b\u5230\u4e86\u4e00\u4e2a\u6df1\u5ea6\u5b66\u4e60\u7684\u6559\u7a0b\u3002", "top": 0, "createdAt": 1726232844, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-13", "dateLabelColor": "#bc4c00"}, "P6": {"htmlDir": "docs/post/2024-nian-9-yue-14-ri.html", "labels": ["\u65e5\u8bb0"], "postTitle": "2024\u5e749\u670814\u65e5", "postUrl": "post/2024-nian-9-yue-14-ri.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/6", "commentNum": 0, "wordCount": 15, "description": "\u5929\u6709\u70b9\u51b7\u4e86\uff0c\u65e9\u4e0a\u8d77\u6765\u6709\u70b9\u6d41\u9f3b\u5b50\u3002", "top": 0, "createdAt": 1726271782, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-14", "dateLabelColor": "#bc4c00"}, "P7": {"htmlDir": "docs/post/2024-nian-9-yue-14-ri-zai-lie-biao-zhong-zhao-dao-liang-ge-shu-de-he-deng-yu-mou-ge-shu-\uff0c-shu-chu-zhe-liang-ge-shu-de-suo-yin.html", "labels": ["\u7f16\u7a0b"], "postTitle": "2024\u5e749\u670814\u65e5\u5728\u5217\u8868\u4e2d\u627e\u5230\u4e24\u4e2a\u6570\u7684\u548c\u7b49\u4e8e\u67d0\u4e2a\u6570\uff0c\u8f93\u51fa\u8fd9\u4e24\u4e2a\u6570\u7684\u7d22\u5f15", "postUrl": "post/2024-nian-9-yue-14-ri-zai-lie-biao-zhong-zhao-dao-liang-ge-shu-de-he-deng-yu-mou-ge-shu-%EF%BC%8C-shu-chu-zhe-liang-ge-shu-de-suo-yin.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/7", "commentNum": 0, "wordCount": 354, "description": "class Solution:\r\n def twoSum(self, nums: List[int], target: int) -> List[int]:\r\n hash_map = {}\r\n for i, num in enumerate(nums):\r\n complement = target - num # \u8ba1\u7b97\u76ee\u6807\u503c\u9700\u8981\u7684\u5dee\u503c\r\n if complement in hash_map: # \u67e5\u627e\u54c8\u5e0c\u8868\u4e2d\u662f\u5426\u5b58\u5728\u8fd9\u4e2a\u5dee\u503c\r\n return [hash_map[complement], i] # \u627e\u5230\u5339\u914d\u9879\uff0c\u8fd4\u56de\u4e24\u4e2a\u7d22\u5f15\r\n hash_map[num] = i \u3002", "top": 0, "createdAt": 1726302707, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-14", "dateLabelColor": "#bc4c00"}, "P8": {"htmlDir": "docs/post/ce-shi-xie-dai-ma.html", "labels": ["\u7f16\u7a0b"], "postTitle": "\u6d4b\u8bd5\u5199\u4ee3\u7801", "postUrl": "post/ce-shi-xie-dai-ma.html", "postSourceUrl": "https://github.com/bg6mgd/blog/issues/8", "commentNum": 0, "wordCount": 381, "description": "\u2018\u2019\u2018\r\nclass Solution:\r\n def twoSum(self, nums: list[int], target: int) -> list[int]:\r\n hash_map = {}\r\n for i, num in enumerate(nums):\r\n complement = target - num # \u8ba1\u7b97\u76ee\u6807\u503c\u9700\u8981\u7684\u5dee\u503c\r\n if complement in hash_map: # \u67e5\u627e\u54c8\u5e0c\u8868\u4e2d\u662f\u5426\u5b58\u5728\u8fd9\u4e2a\u5dee\u503c\r\n return [hash_map[complement], i] # \u627e\u5230\u5339\u914d\u9879\uff0c\u8fd4\u56de\u4e24\u4e2a\u7d22\u5f15\r\n hash_map[num] = i # \u5c06\u5f53\u524d\u6570\u5b57\u548c\u7d22\u5f15\u5b58\u5165\u54c8\u5e0c\u8868\r\n\u2019\u2018\u2019\r\n\u3002", "top": 0, "createdAt": 1726314039, "style": "", "script": "", "head": "", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "createdDate": "2024-09-14", "dateLabelColor": "#bc4c00"}}, "singeListJson": {}, "labelColorDict": {"\u60f3\u6cd5": "#1166EC", "\u6280\u672f\u8bb0\u5f55": "#bfd4f2", "\u65e5\u5e38\u968f\u60f3": "#b60205", "\u65e5\u8bb0": "#D0D9D0", "\u751f\u6d3b": "#80A2E1", "\u7f16\u7a0b": "#AF77D6"}, "displayTitle": "\u4e01\u4e00\u968f\u60f3", "faviconUrl": "https://github.githubassets.com/favicons/favicon.svg", "ogImage": "https://github.githubassets.com/favicons/favicon.svg", "primerCSS": "", "homeUrl": "https://bg6mgd.github.io/blog", "prevUrl": "disabled", "nextUrl": "disabled"} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index dc177c4..9288397 100644 --- a/docs/index.html +++ b/docs/index.html @@ -80,7 +80,18 @@