Created
September 24, 2022 14:40
-
-
Save Vaib215/7df1f0f35bbd3ec340875f7870f56271 to your computer and use it in GitHub Desktop.
Time Complexity = O(n), Space Complexity = O(1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void reverseArr(int arr[]){ | |
int n = arr.length; | |
for(int i=0; i<n/2;i++){ | |
int temp = arr[i]; | |
arr[i] = arr[n-i-1]; | |
arr[n-i-1] = temp; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment