add new solutions
This commit is contained in:
parent
51975f3386
commit
489fa73880
13 changed files with 437 additions and 3 deletions
17
solutions/33/q3379/solution.go
Normal file
17
solutions/33/q3379/solution.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package q3379
|
||||
|
||||
func constructTransformedArray(nums []int) []int {
|
||||
n := len(nums)
|
||||
ret := make([]int, n)
|
||||
for i, num := range nums {
|
||||
num = (i + num) % n
|
||||
if num < 0 {
|
||||
num += n
|
||||
}
|
||||
ret[i] = nums[num]
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
var _ = constructTransformedArray
|
||||
Loading…
Add table
Add a link
Reference in a new issue