From e8e2f249632170cbd25ef874e9875c84784d1440 Mon Sep 17 00:00:00 2001 From: anini <1660470561@qq.com> Date: Sat, 17 Feb 2024 12:42:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Update=201002.=E6=9F=A5=E6=89=BE=E5=B8=B8?= =?UTF-8?q?=E7=94=A8=E5=AD=97=E7=AC=A6.md=20=E6=9B=B4=E6=96=B0Go=E7=89=88?= =?UTF-8?q?=E6=9C=AC-=E6=9B=B4=E6=96=B0=E4=B8=BA=E4=B8=8EC++=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 ++++ problems/1002.查找常用字符.md | 68 ++++++++++++++++------------- 2 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/problems/1002.查找常用字符.md b/problems/1002.查找常用字符.md index 57fa7dae..8d81e3f8 100644 --- a/problems/1002.查找常用字符.md +++ b/problems/1002.查找常用字符.md @@ -327,37 +327,45 @@ var commonChars = function(words) { ### GO ```golang -func commonChars(words []string) []string { - length:=len(words) - fre:=make([][]int,0)//统计每个字符串的词频 - res:=make([]string,0) - //统计词频 - for i:=0;i 0 { + s := string('a' + i) // rune -> string + result = append(result, s) + hash[i]-- + } + } + + return result } -func min(a,b int)int{ - if a>b{ - return b - } - return a + +func min(a, b int) int { + if a < b { + return a + } + return b } ``` From 13edf8d8aa64be5d4e34d64186098c734ba71035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98Carl?= Date: Thu, 22 Feb 2024 14:40:15 +0800 Subject: [PATCH 2/2] Delete .idea/.gitignore --- .idea/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml