I did solved a hackerrank problem which is "Circular Array Rotation" using Go when i run the code it gives me a correct response and when i try to submit the code all the test passes except one and it says Runtime Error
I tried the failing test localy and it passes my code is
package main
import "fmt"
func CircularArrayRotation() {
var n, k, q int
fmt.Scanf("%d%d%d", &n, &k, &q)
a := make([]int, n)
for i := range a {
fmt.Scanf("%d", &a[i])
}
var i int
for t:=0; t<q; t++ {
fmt.Scanf("%d", &i)
j := (i - k)
if j<0 {
j+=n
}
fmt.Println(a[j])
}
}
func main() {
//Enter your code here. Read input from STDIN. Print output to STDOUT
CircularArrayRotation()
}