Sort by

recency

|

2066 Discussions

|

  • + 0 comments

    Idk how we go from lesson 6 to this but okay C++

        for (int i = n-1; i >= 0; i--) {
            int arr_item = stoi(arr_temp[i]);
    
            arr[i] = arr_item;
        cout<<arr[i]<<" ";
        }
    
  • + 0 comments

    for i in range(len(arr)): print(arr[len(arr)-i-1], end=" ")

  • + 0 comments
        for(int i= n-1; i>=0 ; i--){
                System.out.print(arr.get(i)+" ");
            }
    
  • + 0 comments

    My js solution:

    function main() {
        const n = parseInt(readLine().trim(), 10);
        
        const arr = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        let arraux = []
        // Array reverse
        for(let i = n - 1; i >= 0; i --){
            arraux.push(arr[i])            
        }
        console.log(...arraux)
    }
    
  • + 0 comments
    for i in arr[::-1]:
        print(i,end=" ")