LeetCode
leetcode.com › problems › reverse-string
Reverse String - LeetCode
Reverse String - Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place [https://en.wikipedia.org/wiki/In-place_algorithm] with O(1) extra memory.
Medium
medium.com › @kajohnson3140 › reverse-string-in-javascript-leetcode-7cca90996d71
Reverse String in JavaScript, LeetCode | by K. Johnson | Medium
October 18, 2021 - I’m going to walk through a ... from LeetCode’s Top Interview Questions (Easy Collection). ... I’m not sure why the question is posed as a string reversal when the input is already an array but here we go… · This is my solution, which has a runtime of 199ms (beats 9.95% of JS solutions) ...
Videos
07:02
151. Reverse Words in a String | JavaScript | LeetCode | Daily ...
04:19
How to Solve "344 Reverse String" on LeetCode? - Javascript - YouTube
05:36
LeetCode Reverse String in JavaScript - YouTube
05:37
How to Solve "557 Reverse Words in a String III" on LeetCode?
Reverse Integer - LeetCode
LeetCode
leetcode.com › problems › reverse-string-ii
Reverse String II - LeetCode
Reverse String II - Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string. If there are fewer than k characters left, reverse all of them.
LeetCode
leetcode.com › problems › reverse-words-in-a-string
Reverse Words in a String - LeetCode
Can you solve this real interview question? Reverse Words in a String - Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters.
Qiuyuntao
qiuyuntao.github.io › leetcode › solution › 151.html
151. Reverse Words in a String | Leetcode JS Solution (96 / 380)
a b,那这个时候word存在,string也存在,但是在最后的循环的时候是没有进行拼接,所以需要手动再拼接一次 ... var reverseWords = function(str) { var string = ''; var word = ''; for (var i in str) { var s = str[i]; if (s === ' ') { if (!string.length) { string = word; } else if (word.length) { string = word + s + string; } word = ''; } else { word += s; } } if (!string.length) { return word; } else if (string.length && word.length) { return `${word} ${string}` } else if (string.length && !word.length) { return string; } };
GitHub
github.com › doocs › leetcode › blob › main › solution › 0300-0399 › 0344.Reverse String › README_EN.md
leetcode/solution/0300-0399/0344.Reverse String/README_EN.md at main · doocs/leetcode
/** Do not return anything, modify s in-place instead. */ function reverseString(s: string[]): void { for (let i = 0, j = s.length - 1; i < j; ++i, --j) { [s[i], s[j]] = [s[j], s[i]]; } }
Author doocs
AlgoMap
algomap.io › problems › reverse-string
344. Reverse String - Leetcode Solution
The optimal way to reverse a string in-place is by using the two-pointer technique.
GitHub
github.com › doocs › leetcode › blob › main › solution › 0100-0199 › 0151.Reverse Words in a String › README_EN.md
leetcode/solution/0100-0199/0151.Reverse Words in a String/README_EN.md at main · doocs/leetcode
Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space? ... $j$ to find each word, add it to the result list, then reverse the result list, and finally concatenate it into a string.
Author doocs
YouTube
youtube.com › watch
LEETCODE - JS - Reverse String (EASY) - YouTube
LeetCode link: https://leetcode.com/problems/reverse-string
Published September 6, 2024
GitHub
github.com › seognil › leetcode › blob › master › js › problems › 344.reverse-string › solution.ts
leetcode/js/problems/344.reverse-string/solution.ts at master · seognil/leetcode
* @lc app=leetcode id=344 lang=javascript · * * [344] Reverse String · */ /** * @param {character[]} s · * @return {void} Do not return anything, modify s in-place instead. */ const reverseString = (s: string[]): void => { // * ['104 ms', '98.39 %', '46.9 MB', '33.19 %'] ·
Author seognil
LeetCode
leetcode.com › problems › reverse-words-in-a-string-ii
Reverse Words in a String II - LeetCode
Can you solve this real interview question? Reverse Words in a String II - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
WalkCCC
walkccc.me › LeetCode › problems › 541
541. Reverse String II - LeetCode Solutions
LeetCode Solutions in C++23, Java, Python, MySQL, and TypeScript.