Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

Want to add REVERSE ARRAY or REVERSE STRING in C++

Open Venerablevivek opened this issue 2 years ago • 5 comments

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] Given an array, the task is to reverse the array. Examples → Input : arr[] = {34, 12, 23} Output : arr[] = {23, 12, 34} Input : arr[] = {1, 2, 3, 4, 5, 6} Output : arr[] = {6, 5, 4, 3, 2, 1}

We will be discussing a simple approach to reverse the array in-place. In place means, we will not be using some auxiliary space. To reverse an array, we will use the concept of swapping. Swapping is a term used for interchanging the values at two different locations with each other. OPTIMIZED SOLUTION Time Complexity: O(n) Space Complexity: O(1)

Venerablevivek avatar Jun 09 '23 06:06 Venerablevivek

Please Assign this issue to me @Kumar-laxmi ... I want to contribute this

Venerablevivek avatar Jun 09 '23 06:06 Venerablevivek

Please Assign this issue to me @Kumar-laxmi . I want to contribute this in ( Python, C++, C, Java)

avinashvermaaa avatar Jun 09 '23 06:06 avinashvermaaa

@Kumar-laxmi Sir Kindly assign this issue to me I would like to contribute to it and come up with most optimized solution.

anurag-327 avatar Jun 09 '23 16:06 anurag-327

Can you Assign this to me i can solve this problem in the c cpp and python

vivekpal24 avatar Jun 10 '23 17:06 vivekpal24

I can do this by applying two pointers approach where two pointers will be pointing to start and end element of the array respectively and then swapping will be done of starting and ending element. Then the start pointer will be incremented and end pointer will be decremented. This procedure will be followed until start is smaller than end pointer. Kindly assign me this issue I can implement this.

chhavisharma30 avatar Jul 20 '23 07:07 chhavisharma30

Stale issue message

github-actions[bot] avatar Jun 08 '24 16:06 github-actions[bot]