[Leetcode 344]Reverse String

Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
Input: s = ["H","a","n","n","a","h"]
Output: ["h","a","n","n","a","H"]
void reverseString(char* s, int sSize){
for(int i=0; i<sSize/2; i++){
int tmp = s[i];
s[i] = s[sSize-1-i];
s[sSize-1-i] = tmp;
}
}

--

--

--

Hi I am Samuel

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to use the BYG Marketplace.

Facial Recognition using Python library

Graphics Card Switcher Mac Download

Grouping and Organising Test Suite in Playwright

Introducing Trident-M — Imperium Empires Spaceship NFTs #2

SimScale’s Values — Part 7

Looking for a Product Owner? Read This First!

A Practical Introduction to Pandas pivot_table() function

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Samuel Liu

Samuel Liu

Hi I am Samuel

More from Medium

Binary Tree Inorder Traversal

Recursion Explained Using Brian McKnight and A Lawnmower

Recursive functions