
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Reverse a String
								Certification: Basic Level
								Accuracy: 69.57%
								Submissions: 69
								Points: 5
							
							Write a Java program to implement the reverseString(char[] s) function, which reverses a string in-place.
Example 1
- Input: s = ['h', 'e', 'l', 'l', 'o']
 - Output: ['o', 'l', 'l', 'e', 'h']
 - Explanation:
- Swap 'h' and 'o'
 - Swap 'e' and 'l'
 - 'l' stays → final array is reversed
 
 
Example 2
- Input: s = ['H', 'a', 'n', 'n', 'a', 'h']
 - Output: ['h', 'a', 'n', 'n', 'a', 'H']
 - Explanation:
- Swap pairs until midpoint
 - Characters reversed in-place
 
 
Constraints
- 1 ≤ s.length ≤ 10^5
 - s[i] is a printable ascii character
 - Time Complexity: O(n)
 - Space Complexity: O(1)
 
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Use two pointers, one at the start and one at the end of the array
 - Swap the characters at the two pointers
 - Move the left pointer to the right and the right pointer to the left
 - Continue until the pointers meet in the middle