From a73c9c0eec39fbc3c91d41e1b9fdc87c8abe9f6b Mon Sep 17 00:00:00 2001 From: Leonardo Metzger Date: Fri, 1 Sep 2023 08:41:00 -0300 Subject: [PATCH] feat: add betweenTwoSets partially --- implementation/between_two_sets.go | 18 ++++++++++++ implementation/between_two_sets_test.go | 37 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 implementation/between_two_sets.go create mode 100644 implementation/between_two_sets_test.go diff --git a/implementation/between_two_sets.go b/implementation/between_two_sets.go new file mode 100644 index 0000000..d1fc5ab --- /dev/null +++ b/implementation/between_two_sets.go @@ -0,0 +1,18 @@ +package implementation + +// https://www.hackerrank.com/challenges/between-two-sets/problem?isFullScreen=false + +func getTotalX(a []int32, b []int32) int32 { + allFactors := []int32{} + + maxB := 0 + for i := 0; i < len(b); i++ { + maxB = max(maxB, int(b[i])) + } + + for i := 0; i < len(a); i++ { + + } + + return 0 +} diff --git a/implementation/between_two_sets_test.go b/implementation/between_two_sets_test.go new file mode 100644 index 0000000..2c6222a --- /dev/null +++ b/implementation/between_two_sets_test.go @@ -0,0 +1,37 @@ +package implementation + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +type BetweenTwoSetsTestCase struct { + a []int32 + b []int32 + result int32 +} + +func TestBetweenTwoSets(t *testing.T) { + tests := []BetweenTwoSetsTestCase{ + { + a: []int32{2, 4}, + b: []int32{16, 32, 96}, + result: 3, + }, + { + a: []int32{2, 6}, + b: []int32{24, 36}, + result: 2, + }, + { + a: []int32{3, 4}, + b: []int32{24, 48}, + result: 8, + }, + } + + for _, test := range tests { + assert.Equal(t, test.result, getTotalX(test.a, test.b)) + } +}