Reverse the Original Printable-Character Array In Place

Quick Overview

Reverse the Original Printable-Character Array In Place. Reverse s by modifying its original character array in place, using O(1) extra memory. The function returns void. Preserve every printable ASCII character exact

Reverse the Original Printable-Character Array In Place

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Other

### Problem Reverse s by modifying its original character array in place, using O(1) extra memory. The function returns void. Preserve every printable ASCII character exactly, including spaces and punctuation. ```cpp void reverseString(vector<char>& s); ``` ### Examples ```text s = ["a","!","B"," "] -> [" ","B","!","a"] s = ["x"] -> ["x"] ``` ### Constraints - Array length is 1 through 100000. - Every entry is a printable ASCII character.

Overview: Reverse the Original Printable-Character Array In Place. Reverse s by modifying its original character array in place, using O(1) extra memory. The function returns void. Preserve every printable ASCII character exact

Google logo
Google
Date not reported
easySoftware EngineerOtherCoding & Algorithms
0
0

Problem

Reverse s by modifying its original character array in place, using O(1) extra memory. The function returns void. Preserve every printable ASCII character exactly, including spaces and punctuation.

void reverseString(vector<char>& s);

Examples

s = ["a","!","B"," "] -> [" ","B","!","a"]
s = ["x"] -> ["x"]

Constraints

  • Array length is 1 through 100000.
  • Every entry is a printable ASCII character.