diff --git a/go/0912-sort-an-array.go b/go/0912-sort-an-array.go new file mode 100644 index 000000000..74d42e6e7 --- /dev/null +++ b/go/0912-sort-an-array.go @@ -0,0 +1,4 @@ +func sortArray(nums []int) []int { + sort.Ints(nums) + return nums +} diff --git a/go/1929-concatenation-of-array.go b/go/1929-concatenation-of-array.go new file mode 100644 index 000000000..05d29edeb --- /dev/null +++ b/go/1929-concatenation-of-array.go @@ -0,0 +1,11 @@ +func getConcatenation(nums []int) []int { + n := len(nums) + ans := make([]int, 2*n) //lets make an array of int type and 2*n size + i := 0 + for i < n { //implementing for loop for the given condition + ans[i] = nums[i] + ans[i+n] = nums[i] + i++ + } + return ans +}