Skip to content

Commit 1f5f815

Browse files
authored
Merge pull request #2639 from Sar-Go/main
Create: 0912-sort-an-array.go ; Create: 1929-concatenation-of-array.go
2 parents 5abb666 + 0588c2e commit 1f5f815

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

go/0912-sort-an-array.go

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
func sortArray(nums []int) []int {
2+
sort.Ints(nums)
3+
return nums
4+
}

go/1929-concatenation-of-array.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
func getConcatenation(nums []int) []int {
2+
n := len(nums)
3+
ans := make([]int, 2*n) //lets make an array of int type and 2*n size
4+
i := 0
5+
for i < n { //implementing for loop for the given condition
6+
ans[i] = nums[i]
7+
ans[i+n] = nums[i]
8+
i++
9+
}
10+
return ans
11+
}

0 commit comments

Comments
 (0)