Arrays Introduction

  • + 1 comment

    I don't know why the all test cases are not being passed. My code solution is absolutely write as mentioned in the question.

        int size;
    		cin >> size;
        int *a = new int (size);
    
        for (int i = 0; i < size; i++)
        {
            cin >> a[i];
        }
        int front = 0; int rear = size - 1; bool equal = true;
        int temp = 0;
        while (front < rear)
        {
            temp = a[rear];
            a[rear] = a[front];
            a[front] = temp;
            front++; rear--;
        }
        for (int i = 0; i < size; i++)
        {
            cout << a[i] << " ";
        }