Sort by

recency

|

2045 Discussions

|

  • + 0 comments

    code in pyhton 3

    if __name__ == '__main__':
        n = int(input().strip())
    
        arr = list(map(int, input().rstrip().split()))
    arr.reverse()
    print(*arr)
    
  • + 0 comments

    I wasn’t really feeling arrays today

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.insert(0, sc.nextInt() + " ");
        }
        System.out.println(sb.toString().trim());
        sc.close();
    
  • + 0 comments

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

  • + 0 comments

    Python 3

    n = int(input().strip())
    
    arr = list(map(int, input().rstrip().split()))
    
    A = arr[:: -1] 
    
    print(*A , sep=' ')
    
  • + 0 comments

    n = int(input()) arr = list(map(int, input().split())) print(*arr[::-1])