diff --git a/subjects/paramcount.en.md b/subjects/paramcount.en.md index cca06ff6..723347e6 100644 --- a/subjects/paramcount.en.md +++ b/subjects/paramcount.en.md @@ -2,8 +2,7 @@ ### Instructions -Write a program that displays the number of arguments passed to it. This number will be followed by -a newline (`'\n'`). +Write a program that displays the number of arguments passed to it. This number will be followed by a newline (`'\n'`). If there is no argument, the program displays `0` followed by a newline. diff --git a/tests/go/solutions/addlinkednumbers/main.go b/tests/go/solutions/addlinkednumbers/main.go deleted file mode 100644 index 7b642812..00000000 --- a/tests/go/solutions/addlinkednumbers/main.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -type NodeAddL struct { - Next *NodeAddL - Num int -} - -func pushFront(node *NodeAddL, num int) *NodeAddL { - tmp := &NodeAddL{Num: num} - if node == nil { - return tmp - } - tmp.Next = node - return tmp -} - -func AddLinkedNumbers(num1, num2 *NodeAddL) *NodeAddL { - var n1, n2, r int - var result *NodeAddL - - for tmp := num1; tmp != nil; tmp = tmp.Next { - n1 = n1*10 + tmp.Num - } - - for tmp := num2; tmp != nil; tmp = tmp.Next { - n2 = n2*10 + tmp.Num - } - - r = n1 + n2 - for r > 0 { - mod := r % 10 - r /= 10 - result = pushFront(result, mod) - } - return result -} - -func main() { -} diff --git a/tests/go/solutions/changeorder/main.go b/tests/go/solutions/changeorder/main.go deleted file mode 100644 index 3e56dfd7..00000000 --- a/tests/go/solutions/changeorder/main.go +++ /dev/null @@ -1,57 +0,0 @@ -package main - -type NodeAddL struct { - Next *NodeAddL - Num int -} - -func pushBack(node *NodeAddL, num int) *NodeAddL { - nw := &NodeAddL{Num: num} - if node == nil { - return nw - } - for tmp := node; tmp != nil; tmp = tmp.Next { - if tmp.Next == nil { - tmp.Next = nw - return node - } - } - return node -} - -func Changeorder(node *NodeAddL) *NodeAddL { - if node == nil { - return node - } - ans := &NodeAddL{Num: node.Num} - for tmp := node; tmp != nil; { - tmp = tmp.Next - if tmp == nil { - break - } - tmp = tmp.Next - if tmp == nil { - break - } - ans = pushBack(ans, tmp.Num) - } - - if node.Next == nil { - return ans - } - for tmp := node.Next; tmp != nil; { - ans = pushBack(ans, tmp.Num) - tmp = tmp.Next - if tmp == nil { - break - } - tmp = tmp.Next - if tmp == nil { - break - } - } - return ans -} - -func main() { -} diff --git a/tests/go/solutions/chunk.go b/tests/go/solutions/chunk.go index ded67022..17f229f2 100644 --- a/tests/go/solutions/chunk.go +++ b/tests/go/solutions/chunk.go @@ -2,19 +2,19 @@ package correct import "fmt" -func Chunk(arr []int, ch int) { +func Chunk(a []int, ch int) { slice := []int{} if ch <= 0 { fmt.Println() return } - result := make([][]int, 0, len(arr)/ch+1) - for len(arr) >= ch { - slice, arr = arr[:ch], arr[ch:] + result := make([][]int, 0, len(a)/ch+1) + for len(a) >= ch { + slice, a = a[:ch], a[ch:] result = append(result, slice) } - if len(arr) > 0 { - result = append(result, arr[:len(arr)]) + if len(a) > 0 { + result = append(result, a[:len(a)]) } fmt.Println(result) } diff --git a/tests/go/solutions/chunk/main.go b/tests/go/solutions/chunk/main.go deleted file mode 100644 index b539b761..00000000 --- a/tests/go/solutions/chunk/main.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import "fmt" - -func Chunk(slice []int, size int) { - newSlice := []int{} - if size <= 0 { - fmt.Println() - return - } - result := make([][]int, 0, len(slice)/size+1) - for len(slice) >= size { - newSlice, slice = slice[:size], slice[size:] - result = append(result, newSlice) - } - if len(slice) > 0 { - result = append(result, slice[:len(slice)]) - } - fmt.Println(result) -} - -func main() { -} diff --git a/tests/go/solutions/fib/main.go b/tests/go/solutions/fib/main.go deleted file mode 100644 index dae08fbc..00000000 --- a/tests/go/solutions/fib/main.go +++ /dev/null @@ -1,19 +0,0 @@ -package main - -func Fib(n int) int { - if n <= 0 { - return 0 - } - t1 := 0 - t2 := 1 - for i := 2; i <= n; i++ { - t1 += t2 - tmp := t1 - t1 = t2 - t2 = tmp - } - return t2 -} - -func main() { -} diff --git a/tests/go/solutions/foldint/main.go b/tests/go/solutions/foldint/main.go deleted file mode 100644 index 0952c988..00000000 --- a/tests/go/solutions/foldint/main.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import "fmt" - -func FoldInt(f func(int, int) int, a []int, n int) { - result := n - for _, v := range a { - result = f(result, v) - } - fmt.Println(result) -} - -func main() { -} diff --git a/tests/go/solutions/game23/main.go b/tests/go/solutions/game23/main.go deleted file mode 100644 index 228e1934..00000000 --- a/tests/go/solutions/game23/main.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -func Game23(a, b int) int { - if a > b { - return -1 - } - if a == b { - return 0 - } - if Game23(a*2, b) != -1 { - return 1 + Game23(a*2, b) - } - if Game23(a*3, b) != -1 { - return 1 + Game23(a*3, b) - } - return -1 -} - -func main() { -} diff --git a/tests/go/solutions/interestingnumber/main.go b/tests/go/solutions/interestingnumber/main.go deleted file mode 100644 index c30335bb..00000000 --- a/tests/go/solutions/interestingnumber/main.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -func isInteresting(n int) bool { - s := 0 - for n > 0 { - s += n % 10 - n /= 10 - } - return s%7 == 0 -} - -func InterestingNumber(n int) int { - for { - if isInteresting(n) { - return n - } - n++ - } -} - -func main() { -} diff --git a/tests/go/solutions/inverttree/main.go b/tests/go/solutions/inverttree/main.go deleted file mode 100644 index 85ab7316..00000000 --- a/tests/go/solutions/inverttree/main.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -type TNode struct { - Val int - Left *TNode - Right *TNode -} - -func Invert(root *TNode) { - if root != nil { - temp := root.Left - root.Left = root.Right - root.Right = temp - - Invert(root.Left) - Invert(root.Right) - } -} - -func InvertTree(root *TNode) *TNode { - Invert(root) - return root -} - -func main() { -} diff --git a/tests/go/solutions/merge/main.go b/tests/go/solutions/merge/main.go deleted file mode 100644 index 64c1ca41..00000000 --- a/tests/go/solutions/merge/main.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -type TreeNodeM struct { - Left *TreeNodeM - Val int - Right *TreeNodeM -} - -func MergeTrees(t1 *TreeNodeM, t2 *TreeNodeM) *TreeNodeM { - if t1 == nil { - return t2 - } - if t2 == nil { - return t1 - } - t1.Val += t2.Val - t1.Left = MergeTrees(t1.Left, t2.Left) - t1.Right = MergeTrees(t1.Right, t2.Right) - return t1 -} - -func main() { -} diff --git a/tests/go/solutions/nauuo/main.go b/tests/go/solutions/nauuo/main.go deleted file mode 100644 index 38c3d7e5..00000000 --- a/tests/go/solutions/nauuo/main.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -func Nauuo(plus, minus, rand int) string { - if rand == 0 { - if plus > minus { - return "+" - } - if plus < minus { - return "-" - } - if plus == minus { - return "0" - } - } - if plus > minus+rand { - return "+" - } - if plus+rand < minus { - return "-" - } - if (plus+rand >= minus) && (plus-rand <= minus) { - return "?" - } - if (minus+rand >= plus) && (minus-rand <= plus) { - return "?" - } - return "?" -} - -func main() { -} diff --git a/tests/go/solutions/paramcount/test_paramcount.go b/tests/go/solutions/paramcount/test_paramcount.go deleted file mode 100644 index 4d7147ac..00000000 --- a/tests/go/solutions/paramcount/test_paramcount.go +++ /dev/null @@ -1,35 +0,0 @@ -package main - -import ( - "strconv" - - "github.com/01-edu/z01" -) - -func main() { - arg1 := []string{"2", "5", "u", "19"} - arg2 := []string{"2"} - arg3 := []string{"1", "2", "3", "5", "7", "24"} - arg4 := []string{"6", "12", "24"} - - args := [][]string{arg1, arg2, arg3, arg4} - - for i := 0; i < 10; i++ { - var arg []string - init := z01.RandIntBetween(0, 10) - for i := init; i < init+z01.RandIntBetween(5, 10); i++ { - arg = append(arg, strconv.Itoa(i)) - } - args = append(args, arg) - } - - for i := 0; i < 1; i++ { - args = append(args, z01.MultRandWords()) - } - - for _, v := range args { - z01.ChallengeMain("paramcount", v...) - } - - z01.ChallengeMain("paramcount") -} diff --git a/tests/go/solutions/printmemory/main.go b/tests/go/solutions/printmemory/main.go deleted file mode 100644 index 29edd66e..00000000 --- a/tests/go/solutions/printmemory/main.go +++ /dev/null @@ -1,87 +0,0 @@ -package main - -import "github.com/01-edu/z01" - -func printBase(nbr int) int { - var result []rune - base := "0123456789abcdef" - typeBase := []rune(base) - a := 0 - pos := 0 - i := 0 - if nbr == 0 { - result = append(result, '0', '0') - i = 2 - } - for nbr > 0 { - pos = nbr % 16 - nbr = nbr / 16 - result = append(result, typeBase[pos]) - i++ - } - if i == 1 { - result = append(result, '0') - i = 2 - } - for j := i - 1; j >= 0; j-- { - z01.PrintRune(result[j]) - a++ - } - return a -} - -func printascii(a int) { - if a > 31 && a < 127 { - z01.PrintRune(rune(a)) - } else { - z01.PrintRune('.') - } -} - -func printLine(arr [10]int, start int, max int) { - a := 0 - a = start - aux := 0 - var b int - - for a < start+16 && a < max { - if a%4 == 0 && a != 0 { - z01.PrintRune('\n') - } - b = 8 - printBase(arr[a]) - for aux != b { - if b == 6 { - z01.PrintRune('0') - } - if aux == 1 { - z01.PrintRune(' ') - } - if b < 6 { - z01.PrintRune('0') - } - aux++ - } - z01.PrintRune(' ') - aux = 0 - a++ - } - z01.PrintRune('\n') - c := start - for c < start+16 && c < max { - printascii(arr[c]) - c++ - } - z01.PrintRune('\n') -} - -func PrintMemory(arr [10]int) { - i := 0 - size := len(arr) - for i < size { - printLine(arr, i, size) - i += 16 - } -} - -func main() { -} diff --git a/tests/go/solutions/priorprime/main.go b/tests/go/solutions/priorprime/main.go deleted file mode 100644 index 6a673c6d..00000000 --- a/tests/go/solutions/priorprime/main.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -func PriorPrime(x int) int { - ans := 0 - ok := 0 - for i := 2; i < x; i++ { - ok = 1 - for j := 2; j*j <= i; j++ { - if i%j == 0 { - ok = 0 - } - } - if ok == 1 { - ans += i - } - } - return ans -} - -func main() { -} diff --git a/tests/go/solutions/reduceint.go b/tests/go/solutions/reduceint.go index a62a06dc..8967d456 100644 --- a/tests/go/solutions/reduceint.go +++ b/tests/go/solutions/reduceint.go @@ -2,10 +2,10 @@ package correct import "fmt" -func ReduceInt(f func(int, int) int, arr []int) { - acc := arr[0] - for i := 1; i < len(arr); i++ { - acc = f(acc, arr[i]) +func ReduceInt(f func(int, int) int, a []int) { + acc := a[0] + for i := 1; i < len(a); i++ { + acc = f(acc, a[i]) } fmt.Println(acc) } diff --git a/tests/go/solutions/reduceint/main.go b/tests/go/solutions/reduceint/main.go deleted file mode 100644 index 0b09982c..00000000 --- a/tests/go/solutions/reduceint/main.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import "fmt" - -func ReduceInt(f func(int, int) int, arr []int) { - acc := arr[0] - for i := 1; i < len(arr); i++ { - acc = f(acc, arr[i]) - } - fmt.Println(acc) -} - -func main() { -} diff --git a/tests/go/solutions/reverse.go b/tests/go/solutions/reverse.go index fb4ed096..7ef97378 100644 --- a/tests/go/solutions/reverse.go +++ b/tests/go/solutions/reverse.go @@ -1,5 +1,19 @@ package correct +type NodeAddL struct { + Next *NodeAddL + Num int +} + +func pushFront(node *NodeAddL, num int) *NodeAddL { + tmp := &NodeAddL{Num: num} + if node == nil { + return tmp + } + tmp.Next = node + return tmp +} + func Reverse(node *NodeAddL) *NodeAddL { if node == nil { return node diff --git a/tests/go/solutions/reverse/main.go b/tests/go/solutions/reverse/main.go deleted file mode 100644 index cb570e58..00000000 --- a/tests/go/solutions/reverse/main.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -type NodeAddL struct { - Next *NodeAddL - Num int -} - -func pushFront(node *NodeAddL, num int) *NodeAddL { - tmp := &NodeAddL{Num: num} - if node == nil { - return tmp - } - tmp.Next = node - return tmp -} - -func Reverse(node *NodeAddL) *NodeAddL { - if node == nil { - return node - } - ans := &NodeAddL{Num: node.Num} - for tmp := node.Next; tmp != nil; tmp = tmp.Next { - ans = pushFront(ans, tmp.Num) - } - return ans -} - -func main() { -} diff --git a/tests/go/solutions/revivethreenums/main.go b/tests/go/solutions/revivethreenums/main.go deleted file mode 100644 index 2ebdc823..00000000 --- a/tests/go/solutions/revivethreenums/main.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -func more(a, b int) int { - if a < b { - return b - } - return a -} - -func max(a, b, c, d int) int { - if a >= b && a >= c && a >= d { - return a - } - if b >= a && b >= c && b >= d { - return b - } - if c >= a && c >= b && c >= d { - return c - } - if d >= a && d >= b && d >= c { - return d - } - return -1 -} - -func ReviveThreeNums(a, b, c, d int) int { - maxi := -111 - if a != max(a, b, c, d) { - maxi = more(maxi, max(a, b, c, d)-a) - } - if b != max(a, b, c, d) { - maxi = more(maxi, max(a, b, c, d)-b) - } - if c != max(a, b, c, d) { - maxi = more(maxi, max(a, b, c, d)-c) - } - if d != max(a, b, c, d) { - maxi = more(maxi, max(a, b, c, d)-d) - } - return maxi -} - -func main() { -} diff --git a/tests/go/solutions/sametree/main.go b/tests/go/solutions/sametree/main.go deleted file mode 100644 index 69671e2c..00000000 --- a/tests/go/solutions/sametree/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -type TreeNodeL struct { - Left *TreeNodeL - Val int - Right *TreeNodeL -} - -func IsSameTree(p *TreeNodeL, q *TreeNodeL) bool { - if p == nil && q == nil { - return true - } - return checkIfEq(p, q) -} - -func checkIfEq(t1 *TreeNodeL, t2 *TreeNodeL) bool { - if t1 == nil && t2 == nil { - return true - } - if t1 == nil || t2 == nil { - return false - } - return t1.Val == t2.Val && checkIfEq(t1.Right, t2.Right) && checkIfEq(t1.Left, t2.Left) -} - -func main() { -} diff --git a/tests/go/solutions/sortll.go b/tests/go/solutions/sortll.go index 16f6f578..968bfc4b 100644 --- a/tests/go/solutions/sortll.go +++ b/tests/go/solutions/sortll.go @@ -1,5 +1,24 @@ package correct +type NodeAddL struct { + Next *NodeAddL + Num int +} + +func pushBack(node *NodeAddL, num int) *NodeAddL { + nw := &NodeAddL{Num: num} + if node == nil { + return nw + } + for tmp := node; tmp != nil; tmp = tmp.Next { + if tmp.Next == nil { + tmp.Next = nw + return node + } + } + return node +} + func Sortll(node *NodeAddL) *NodeAddL { if node == nil { return node diff --git a/tests/go/solutions/sortll/main.go b/tests/go/solutions/sortll/main.go deleted file mode 100644 index bac6ae9e..00000000 --- a/tests/go/solutions/sortll/main.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -type NodeAddL struct { - Next *NodeAddL - Num int -} - -func pushBack(node *NodeAddL, num int) *NodeAddL { - nw := &NodeAddL{Num: num} - if node == nil { - return nw - } - for tmp := node; tmp != nil; tmp = tmp.Next { - if tmp.Next == nil { - tmp.Next = nw - return node - } - } - return node -} - -func Sortll(node *NodeAddL) *NodeAddL { - if node == nil { - return node - } - - for first := node; first != nil; first = first.Next { - for second := first.Next; second != nil; second = second.Next { - if first.Num < second.Num { - tmp := first.Num - first.Num = second.Num - second.Num = tmp - } - } - } - return node -} - -func main() { -} diff --git a/tests/go/solutions/swapbits/main.go b/tests/go/solutions/swapbits/main.go deleted file mode 100644 index 4983ca26..00000000 --- a/tests/go/solutions/swapbits/main.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -func SwapBits(n byte) byte { - return ((n >> 4) | (n << 4)) -} - -func main() { -} diff --git a/tests/go/solutions/swapbits/test_swapbits.go b/tests/go/solutions/swapbits/test_swapbits.go deleted file mode 100644 index d85b2778..00000000 --- a/tests/go/solutions/swapbits/test_swapbits.go +++ /dev/null @@ -1,35 +0,0 @@ -package main - -import ( - "reflect" - - "github.com/01-edu/z01" - - correct "./correct" -) - -func challengeBytes(fn1, fn2 interface{}, args ...interface{}) { - st1 := z01.Monitor(fn1, args) - st2 := z01.Monitor(fn2, args) - if !reflect.DeepEqual(st1.Results, st2.Results) { - z01.Fatalf("%s(%08b) == %08b instead of %08b\n", - "SwapBits", - args[0].(byte), - st1.Results[0].(byte), - st2.Results[0].(byte), - ) - } -} - -func main() { - args := []byte{0x24, 0x14, 0x11, 0x22, 0xd2, 0x15, 0xff, 0x0, 0x35, 0x58, 0x43} - - for i := 0; i < 10; i++ { - n := z01.RandIntBetween(0, 255) - args = append(args, byte(n)) - } - - for _, v := range args { - challengeBytes(SwapBits, correct.SwapBits, v) - } -} diff --git a/tests/go/solutions/sweetproblem/main.go b/tests/go/solutions/sweetproblem/main.go deleted file mode 100644 index a35a852c..00000000 --- a/tests/go/solutions/sweetproblem/main.go +++ /dev/null @@ -1,60 +0,0 @@ -package main - -func min3(a, b, c int) int { - if a <= b && a <= c { - return a - } - if b <= a && b <= c { - return b - } - return c -} - -func max3(a, b, c int) int { - if a >= b && a >= c { - return a - } - if b >= a && b >= c { - return b - } - return c -} - -func min2(a, b int) int { - if a <= b { - return a - } - return b -} - -func Sweetproblem(a, b, c int) int { - if a > b { - f := a - a = b - b = f - } - if a > c { - f := a - a = c - c = f - } - if b > c { - f := b - b = c - c = f - } - ans := a - if c-b >= a { - c -= a - } else { - a -= c - b - half := a / 2 - c -= half - b -= a - half - } - ans += min2(b, c) - return ans -} - -func main() { -} diff --git a/tests/go/solutions/twosum/main.go b/tests/go/solutions/twosum/main.go deleted file mode 100644 index cd6b3c50..00000000 --- a/tests/go/solutions/twosum/main.go +++ /dev/null @@ -1,15 +0,0 @@ -package main - -func TwoSum(nums []int, target int) []int { - for i := 0; i < len(nums); i++ { - for j := i + 1; j < len(nums); j++ { - if nums[i]+nums[j] == target { - return []int{i, j} - } - } - } - return nil -} - -func main() { -} diff --git a/tests/go/solutions/volumechanger/main.go b/tests/go/solutions/volumechanger/main.go deleted file mode 100644 index 3e06dac4..00000000 --- a/tests/go/solutions/volumechanger/main.go +++ /dev/null @@ -1,15 +0,0 @@ -package main - -func abs(a int) int { - if a < 0 { - return -a - } - return a -} - -func Volumechanger(a, b int) int { - return abs(a-b)/5 + abs(a-b)%5/2 + abs(a-b)%5%2 -} - -func main() { -} diff --git a/tests/go/solutions/addlinkednumbers/test_addlinkednumbers.go b/tests/go/test_addlinkednumbers.go similarity index 100% rename from tests/go/solutions/addlinkednumbers/test_addlinkednumbers.go rename to tests/go/test_addlinkednumbers.go diff --git a/tests/go/solutions/addprimesum/test_addprimesum.go b/tests/go/test_addprimesum.go similarity index 100% rename from tests/go/solutions/addprimesum/test_addprimesum.go rename to tests/go/test_addprimesum.go diff --git a/tests/go/solutions/alphamirror/test_alphamirror.go b/tests/go/test_alphamirror.go similarity index 100% rename from tests/go/solutions/alphamirror/test_alphamirror.go rename to tests/go/test_alphamirror.go diff --git a/tests/go/solutions/balancedstring/test_balancedstring.go b/tests/go/test_balancedstring.go similarity index 100% rename from tests/go/solutions/balancedstring/test_balancedstring.go rename to tests/go/test_balancedstring.go diff --git a/tests/go/solutions/brackets/test_brackets.go b/tests/go/test_brackets.go similarity index 100% rename from tests/go/solutions/brackets/test_brackets.go rename to tests/go/test_brackets.go diff --git a/tests/go/solutions/brainfuck/test_brainfuck.go b/tests/go/test_brainfuck.go similarity index 100% rename from tests/go/solutions/brainfuck/test_brainfuck.go rename to tests/go/test_brainfuck.go diff --git a/tests/go/solutions/changeorder/test_changeorder.go b/tests/go/test_changeorder.go similarity index 100% rename from tests/go/solutions/changeorder/test_changeorder.go rename to tests/go/test_changeorder.go diff --git a/tests/go/solutions/chunk/test_chunk.go b/tests/go/test_chunk.go similarity index 100% rename from tests/go/solutions/chunk/test_chunk.go rename to tests/go/test_chunk.go diff --git a/tests/go/solutions/cleanstr/test_cleanstr.go b/tests/go/test_cleanstr.go similarity index 100% rename from tests/go/solutions/cleanstr/test_cleanstr.go rename to tests/go/test_cleanstr.go diff --git a/tests/go/solutions/costumeprofit/test_costumeprofit.go b/tests/go/test_costumeprofit.go similarity index 100% rename from tests/go/solutions/costumeprofit/test_costumeprofit.go rename to tests/go/test_costumeprofit.go diff --git a/tests/go/solutions/countdown/test_countdown.go b/tests/go/test_countdown.go similarity index 100% rename from tests/go/solutions/countdown/test_countdown.go rename to tests/go/test_countdown.go diff --git a/tests/go/solutions/displaya/test_displaya.go b/tests/go/test_displaya.go similarity index 100% rename from tests/go/solutions/displaya/test_displaya.go rename to tests/go/test_displaya.go diff --git a/tests/go/solutions/displayalpham/test_displayalpham.go b/tests/go/test_displayalpham.go similarity index 100% rename from tests/go/solutions/displayalpham/test_displayalpham.go rename to tests/go/test_displayalpham.go diff --git a/tests/go/solutions/displayalrevm/test_displayalrevm.go b/tests/go/test_displayalrevm.go similarity index 100% rename from tests/go/solutions/displayalrevm/test_displayalrevm.go rename to tests/go/test_displayalrevm.go diff --git a/tests/go/solutions/displayfirstparam/test_displayfirstparam.go b/tests/go/test_displayfirstparam.go similarity index 100% rename from tests/go/solutions/displayfirstparam/test_displayfirstparam.go rename to tests/go/test_displayfirstparam.go diff --git a/tests/go/solutions/displaylastparam/test_displaylastparam.go b/tests/go/test_displaylastparam.go similarity index 100% rename from tests/go/solutions/displaylastparam/test_displaylastparam.go rename to tests/go/test_displaylastparam.go diff --git a/tests/go/solutions/displayz/test_displayz.go b/tests/go/test_displayz.go similarity index 100% rename from tests/go/solutions/displayz/test_displayz.go rename to tests/go/test_displayz.go diff --git a/tests/go/solutions/expandstr/test_expandstr.go b/tests/go/test_expandstr.go similarity index 100% rename from tests/go/solutions/expandstr/test_expandstr.go rename to tests/go/test_expandstr.go diff --git a/tests/go/solutions/fib/test_fib.go b/tests/go/test_fib.go similarity index 100% rename from tests/go/solutions/fib/test_fib.go rename to tests/go/test_fib.go diff --git a/tests/go/solutions/firstword/test_firstword.go b/tests/go/test_firstword.go similarity index 100% rename from tests/go/solutions/firstword/test_firstword.go rename to tests/go/test_firstword.go diff --git a/tests/go/solutions/foldint/test_foldint.go b/tests/go/test_foldint.go similarity index 100% rename from tests/go/solutions/foldint/test_foldint.go rename to tests/go/test_foldint.go diff --git a/tests/go/solutions/fprime/test_fprime.go b/tests/go/test_fprime.go similarity index 100% rename from tests/go/solutions/fprime/test_fprime.go rename to tests/go/test_fprime.go diff --git a/tests/go/solutions/game23/test_game23.go b/tests/go/test_game23.go similarity index 100% rename from tests/go/solutions/game23/test_game23.go rename to tests/go/test_game23.go diff --git a/tests/go/solutions/gcd/test_gcd.go b/tests/go/test_gcd.go similarity index 100% rename from tests/go/solutions/gcd/test_gcd.go rename to tests/go/test_gcd.go diff --git a/tests/go/solutions/grouping/test_grouping.go b/tests/go/test_grouping.go similarity index 100% rename from tests/go/solutions/grouping/test_grouping.go rename to tests/go/test_grouping.go diff --git a/tests/go/solutions/hello/test_hello.go b/tests/go/test_hello.go similarity index 100% rename from tests/go/solutions/hello/test_hello.go rename to tests/go/test_hello.go diff --git a/tests/go/solutions/hiddenp/test_hiddenp.go b/tests/go/test_hiddenp.go similarity index 100% rename from tests/go/solutions/hiddenp/test_hiddenp.go rename to tests/go/test_hiddenp.go diff --git a/tests/go/solutions/inter/test_inter.go b/tests/go/test_inter.go similarity index 100% rename from tests/go/solutions/inter/test_inter.go rename to tests/go/test_inter.go diff --git a/tests/go/solutions/interestingnumber/test_interestingnumber.go b/tests/go/test_interestingnumber.go similarity index 100% rename from tests/go/solutions/interestingnumber/test_interestingnumber.go rename to tests/go/test_interestingnumber.go diff --git a/tests/go/solutions/inverttree/test_inverttree.go b/tests/go/test_inverttree.go similarity index 100% rename from tests/go/solutions/inverttree/test_inverttree.go rename to tests/go/test_inverttree.go diff --git a/tests/go/solutions/isanagram/test_isanagram.go b/tests/go/test_isanagram.go similarity index 100% rename from tests/go/solutions/isanagram/test_isanagram.go rename to tests/go/test_isanagram.go diff --git a/tests/go/solutions/ispowerof2/test_ispowerof2.go b/tests/go/test_ispowerof2.go similarity index 100% rename from tests/go/solutions/ispowerof2/test_ispowerof2.go rename to tests/go/test_ispowerof2.go diff --git a/tests/go/solutions/lastword/test_lastword.go b/tests/go/test_lastword.go similarity index 100% rename from tests/go/solutions/lastword/test_lastword.go rename to tests/go/test_lastword.go diff --git a/tests/go/solutions/lcm/test_lcm.go b/tests/go/test_lcm.go similarity index 100% rename from tests/go/solutions/lcm/test_lcm.go rename to tests/go/test_lcm.go diff --git a/tests/go/solutions/merge/test_merge.go b/tests/go/test_merge.go similarity index 100% rename from tests/go/solutions/merge/test_merge.go rename to tests/go/test_merge.go diff --git a/tests/go/solutions/nauuo/test_nauuo.go b/tests/go/test_nauuo.go similarity index 100% rename from tests/go/solutions/nauuo/test_nauuo.go rename to tests/go/test_nauuo.go diff --git a/tests/go/solutions/nenokku/test_nenokku.go b/tests/go/test_nenokku.go similarity index 100% rename from tests/go/solutions/nenokku/test_nenokku.go rename to tests/go/test_nenokku.go diff --git a/tests/go/solutions/onlya/test_onlya.go b/tests/go/test_onlya.go similarity index 100% rename from tests/go/solutions/onlya/test_onlya.go rename to tests/go/test_onlya.go diff --git a/tests/go/solutions/onlyz/test_onlyz.go b/tests/go/test_onlyz.go similarity index 100% rename from tests/go/solutions/onlyz/test_onlyz.go rename to tests/go/test_onlyz.go diff --git a/tests/go/solutions/options/test_options.go b/tests/go/test_options.go similarity index 100% rename from tests/go/solutions/options/test_options.go rename to tests/go/test_options.go diff --git a/tests/go/test_paramcount.go b/tests/go/test_paramcount.go index 4d7147ac..612ded05 100644 --- a/tests/go/test_paramcount.go +++ b/tests/go/test_paramcount.go @@ -7,12 +7,12 @@ import ( ) func main() { - arg1 := []string{"2", "5", "u", "19"} - arg2 := []string{"2"} - arg3 := []string{"1", "2", "3", "5", "7", "24"} - arg4 := []string{"6", "12", "24"} - - args := [][]string{arg1, arg2, arg3, arg4} + args := [][]string{ + {"2", "5", "u", "19"}, + {"2"}, + {"1", "2", "3", "5", "7", "24"}, + {"6", "12", "24"}, + } for i := 0; i < 10; i++ { var arg []string diff --git a/tests/go/solutions/piglatin/test_piglatin.go b/tests/go/test_piglatin.go similarity index 100% rename from tests/go/solutions/piglatin/test_piglatin.go rename to tests/go/test_piglatin.go diff --git a/tests/go/solutions/printbits/test_printbits.go b/tests/go/test_printbits.go similarity index 100% rename from tests/go/solutions/printbits/test_printbits.go rename to tests/go/test_printbits.go diff --git a/tests/go/solutions/printchessboard/test_printchessboard.go b/tests/go/test_printchessboard.go similarity index 100% rename from tests/go/solutions/printchessboard/test_printchessboard.go rename to tests/go/test_printchessboard.go diff --git a/tests/go/solutions/printhex/test_printhex.go b/tests/go/test_printhex.go similarity index 100% rename from tests/go/solutions/printhex/test_printhex.go rename to tests/go/test_printhex.go diff --git a/tests/go/solutions/printmemory/test_printmemory.go b/tests/go/test_printmemory.go similarity index 100% rename from tests/go/solutions/printmemory/test_printmemory.go rename to tests/go/test_printmemory.go diff --git a/tests/go/solutions/priorprime/test_priorprime.go b/tests/go/test_priorprime.go similarity index 100% rename from tests/go/solutions/priorprime/test_priorprime.go rename to tests/go/test_priorprime.go diff --git a/tests/go/solutions/range/test_range.go b/tests/go/test_range.go similarity index 100% rename from tests/go/solutions/range/test_range.go rename to tests/go/test_range.go diff --git a/tests/go/solutions/reduceint/test_reduceint.go b/tests/go/test_reduceint.go similarity index 100% rename from tests/go/solutions/reduceint/test_reduceint.go rename to tests/go/test_reduceint.go diff --git a/tests/go/solutions/repeatalpha/test_repeatalpha.go b/tests/go/test_repeatalpha.go similarity index 100% rename from tests/go/solutions/repeatalpha/test_repeatalpha.go rename to tests/go/test_repeatalpha.go diff --git a/tests/go/solutions/reverse/test_reverse.go b/tests/go/test_reverse.go similarity index 100% rename from tests/go/solutions/reverse/test_reverse.go rename to tests/go/test_reverse.go diff --git a/tests/go/solutions/reversebits/test_reversebits.go b/tests/go/test_reversebits.go similarity index 100% rename from tests/go/solutions/reversebits/test_reversebits.go rename to tests/go/test_reversebits.go diff --git a/tests/go/solutions/reverserange/test_reverserange.go b/tests/go/test_reverserange.go similarity index 100% rename from tests/go/solutions/reverserange/test_reverserange.go rename to tests/go/test_reverserange.go diff --git a/tests/go/solutions/reversestrcap/test_reversestrcap.go b/tests/go/test_reversestrcap.go similarity index 100% rename from tests/go/solutions/reversestrcap/test_reversestrcap.go rename to tests/go/test_reversestrcap.go diff --git a/tests/go/solutions/revivethreenums/test_revivethreenums.go b/tests/go/test_revivethreenums.go similarity index 100% rename from tests/go/solutions/revivethreenums/test_revivethreenums.go rename to tests/go/test_revivethreenums.go diff --git a/tests/go/solutions/revwstr/test_revwstr.go b/tests/go/test_revwstr.go similarity index 100% rename from tests/go/solutions/revwstr/test_revwstr.go rename to tests/go/test_revwstr.go diff --git a/tests/go/solutions/robottoorigin/test_robottoorigin.go b/tests/go/test_robottoorigin.go similarity index 100% rename from tests/go/solutions/robottoorigin/test_robottoorigin.go rename to tests/go/test_robottoorigin.go diff --git a/tests/go/solutions/romannumbers/test_romannumbers.go b/tests/go/test_romannumbers.go similarity index 100% rename from tests/go/solutions/romannumbers/test_romannumbers.go rename to tests/go/test_romannumbers.go diff --git a/tests/go/solutions/rostring/test_rostring.go b/tests/go/test_rostring.go similarity index 100% rename from tests/go/solutions/rostring/test_rostring.go rename to tests/go/test_rostring.go diff --git a/tests/go/solutions/rot13/test_rot13.go b/tests/go/test_rot13.go similarity index 100% rename from tests/go/solutions/rot13/test_rot13.go rename to tests/go/test_rot13.go diff --git a/tests/go/solutions/rpncalc/test_rpncalc.go b/tests/go/test_rpncalc.go similarity index 100% rename from tests/go/solutions/rpncalc/test_rpncalc.go rename to tests/go/test_rpncalc.go diff --git a/tests/go/solutions/sametree/test_sametree.go b/tests/go/test_sametree.go similarity index 100% rename from tests/go/solutions/sametree/test_sametree.go rename to tests/go/test_sametree.go diff --git a/tests/go/solutions/searchreplace/test_searchreplace.go b/tests/go/test_searchreplace.go similarity index 100% rename from tests/go/solutions/searchreplace/test_searchreplace.go rename to tests/go/test_searchreplace.go diff --git a/tests/go/solutions/sortll/test_sortll.go b/tests/go/test_sortll.go similarity index 100% rename from tests/go/solutions/sortll/test_sortll.go rename to tests/go/test_sortll.go diff --git a/tests/go/solutions/sweetproblem/test_sweetproblem.go b/tests/go/test_sweetproblem.go similarity index 100% rename from tests/go/solutions/sweetproblem/test_sweetproblem.go rename to tests/go/test_sweetproblem.go diff --git a/tests/go/solutions/switchcase/test_switchcase.go b/tests/go/test_switchcase.go similarity index 100% rename from tests/go/solutions/switchcase/test_switchcase.go rename to tests/go/test_switchcase.go diff --git a/tests/go/solutions/tabmult/test_tabmult.go b/tests/go/test_tabmult.go similarity index 100% rename from tests/go/solutions/tabmult/test_tabmult.go rename to tests/go/test_tabmult.go diff --git a/tests/go/solutions/twosum/test_twosum.go b/tests/go/test_twosum.go similarity index 100% rename from tests/go/solutions/twosum/test_twosum.go rename to tests/go/test_twosum.go diff --git a/tests/go/solutions/union/test_union.go b/tests/go/test_union.go similarity index 100% rename from tests/go/solutions/union/test_union.go rename to tests/go/test_union.go diff --git a/tests/go/solutions/uniqueoccurences/test_uniqueoccurences.go b/tests/go/test_uniqueoccurences.go similarity index 100% rename from tests/go/solutions/uniqueoccurences/test_uniqueoccurences.go rename to tests/go/test_uniqueoccurences.go diff --git a/tests/go/solutions/volumechanger/test_volumechanger.go b/tests/go/test_volumechanger.go similarity index 100% rename from tests/go/solutions/volumechanger/test_volumechanger.go rename to tests/go/test_volumechanger.go diff --git a/tests/go/solutions/wdmatch/test_wdmatch.go b/tests/go/test_wdmatch.go similarity index 100% rename from tests/go/solutions/wdmatch/test_wdmatch.go rename to tests/go/test_wdmatch.go