프로그래머스 알고리즘 푸는데


func solution(array []int, commands [][]int) []int {
    result := []int{}
    v := []int{}

    for i := 0; i < len(commands); i++ {
        v = array[commands[i][0]-1 : commands[i][1]]

        for j := 0; j < len(v); j++ {
            for k := 0; k < len(v); k++ {
                temp := v[k]
                if temp > v[j] {
                    temp = v[j]
                    v[j] = v[k]
                    v[k] = temp
                }
            }
        }

        result = append(result, v[commands[i][2]-1])
    }

    return result
}


요건데 v 값을 바꿔도 array 값도 바뀝니다