From d4853bf39e34a45a6de3ffb095fb364a33b836c9 Mon Sep 17 00:00:00 2001 From: zuruoke Date: Sun, 8 May 2022 16:27:03 +0100 Subject: [PATCH 1/3] added 1_twoSum solution golang --- go/blind75/arrayAndHashing/1_twoSum.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 go/blind75/arrayAndHashing/1_twoSum.go diff --git a/go/blind75/arrayAndHashing/1_twoSum.go b/go/blind75/arrayAndHashing/1_twoSum.go new file mode 100644 index 000000000..0d8c0ca30 --- /dev/null +++ b/go/blind75/arrayAndHashing/1_twoSum.go @@ -0,0 +1,14 @@ +package arrayandhashing + +func twoSum(nums []int, target int) []int { + m := make(map[int]int) + for idx, num := range nums { + + if val, found := m[target-num]; found { + return []int{val, idx} + } + + m[num] = idx + } + return nil +} From 66a4d3f184aeb3b982f175794f370ba310c40061 Mon Sep 17 00:00:00 2001 From: zuruoke Date: Tue, 12 Jul 2022 20:14:32 +0100 Subject: [PATCH 2/3] change to snake_case convention --- .../1_twoSum.go => blind_75/arrays_&_hashing/1-Two-Sum.go} | 0 .../arrays_&_hashing}/217_containsDuplicate.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename go/{blind75/arrayAndHashing/1_twoSum.go => blind_75/arrays_&_hashing/1-Two-Sum.go} (100%) rename go/{blind75/arrayAndHashing => blind_75/arrays_&_hashing}/217_containsDuplicate.go (100%) diff --git a/go/blind75/arrayAndHashing/1_twoSum.go b/go/blind_75/arrays_&_hashing/1-Two-Sum.go similarity index 100% rename from go/blind75/arrayAndHashing/1_twoSum.go rename to go/blind_75/arrays_&_hashing/1-Two-Sum.go diff --git a/go/blind75/arrayAndHashing/217_containsDuplicate.go b/go/blind_75/arrays_&_hashing/217_containsDuplicate.go similarity index 100% rename from go/blind75/arrayAndHashing/217_containsDuplicate.go rename to go/blind_75/arrays_&_hashing/217_containsDuplicate.go From 393b82b9c500d37624bb68a97e67ff91cc5dd4af Mon Sep 17 00:00:00 2001 From: zuruoke Date: Tue, 12 Jul 2022 20:15:07 +0100 Subject: [PATCH 3/3] change to snake_case convention --- .../{217_containsDuplicate.go => 217-Contains-Duplicate.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename go/blind_75/arrays_&_hashing/{217_containsDuplicate.go => 217-Contains-Duplicate.go} (100%) diff --git a/go/blind_75/arrays_&_hashing/217_containsDuplicate.go b/go/blind_75/arrays_&_hashing/217-Contains-Duplicate.go similarity index 100% rename from go/blind_75/arrays_&_hashing/217_containsDuplicate.go rename to go/blind_75/arrays_&_hashing/217-Contains-Duplicate.go