🌐
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 › @stheodorejohn › reversing-a-string-in-place-leetcode-javascript-solution-366d7c13f9bc
Reversing a String in Place — LeetCode JavaScript Solution | by Theodore John.S | Medium
November 27, 2023 - In this article, we will explore the LeetCode problem “Reverse String” and provide a JavaScript solution to reverse an array of characters in place. The challenge here is to modify the input array in situ, without using additional memory (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 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) and memory usage of 46.1MB (beats 67% of JS solutions). I toyed with having a variable halfLength for the loop, which sometimes lowered memory usage significantly but also increased runtime. I get different numbers every time I submit a LeetCode solution so it’s basically a toss up and I went with a cleaner version without the variable.
🌐
DEV Community
dev.to › cod3pineapple › leetcode-541-reverse-string-ii-javascript-solution-4o9o
LeetCode 541. Reverse String II (Javascript solution) - DEV Community
March 22, 2021 - var reverseStr = function(s, k) { // strings are immutable in javascript // converting to an array will allow in place letter swapping const a = s.split(''); // loop through the array in 2*k increments for (let start = 0; start < a.length; start ...
🌐
DEV Community
dev.to › rahulgithubweb › leetcode-challenge-151-reverse-words-in-a-string-javascript-solution-3j2
LeetCode Challenge: 151. Reverse Words in a String - JavaScript Solution 🚀 - DEV Community
December 24, 2024 - Reversing the words in a string while handling multiple spaces efficiently is a common problem in string manipulation. Let's tackle LeetCode 151: Reverse Words in a String with an optimized solution and without using predefined methods like split or trim.
🌐
Medium
valentinplacido25.medium.com › leetcode-344-reverse-string-javascript-basics-b390f64d05b8
LeetCode 344. Reverse String — JavaScript Basics - Valentin Placido - Medium
October 18, 2020 - var reverseString = function(s) { for (let i = 0; i < s.length/2; i++) { let n = s[i] s[i] = s[s.length-i-1] s[s.length-i-1] = n } }; This solution will use a for loop to iterate the string all the way to the middle and swap the left side character ...
🌐
Rishabh1403
rishabh1403.com › posts › coding › leetcode › 2020 › 05 › leetcode-reverse-vowels-of-a-string
Leetcode | Solution of Reverse Vowels of a String in JavaScript | Rishabh Jain
The approach is as follows · We declare an array of vowels and assign all the uppercase and lowercase vowels to it · Next, we convert the string to an array and apply two pointer approach to reverse the vowels
🌐
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.
Find elsewhere
🌐
YouTube
youtube.com › watch
151. Reverse Words in a String - LeetCode - JavaScript - YouTube
Join my Discord channel https://discord.gg/BNtP63BdJARecursion Playlist https://www.youtube.com/playlist?list=PL3eqOYN9nzwWc74-TTIpfzy2UoBkKhycaLeetCode Dail...
Published   December 20, 2023
🌐
YouTube
youtube.com › knowledge mavens
LeetCode Reverse String in JavaScript - YouTube
#LeetCode #JavaScript #CodeInterviewhttps://github.com/gbrough/LeetCode/blob/main/JavaScript/Reverse String.jsCheck us out on Social Media athttps://www.kn...
Published   May 22, 2021
Views   646
🌐
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 The Hard Way
leetcodethehardway.com › 0300 - 0399 › 0344 - reverse string (easy)
0344 - Reverse String (Easy) | LeetCode The Hard Way
/** * @param {character[]} s * @return {void} Do not return anything, modify s in-place instead. */ var reverseString = function (s) { let left = 0; let right = s.length - 1; while (left < right) { char = s[left]; s[left] = s[right]; s[right] = char; left++; right--; } };
🌐
Medium
lydiaplu.medium.com › leetcode-541-reverse-string-ii-24a879b40fdd
LeetCode — 541. Reverse String II | by Pan Lu | Medium
January 31, 2024 - class Solution { public String reverseStr(String s, int k) { char[] arr = s.toCharArray(); for (int i = 0; i < arr.length; i += 2 * k) { int left = i; int right = i + k - 1; if (right >= arr.length) { right = arr.length - 1; } while (left < right) { char temp = arr[left]; arr[left] = arr[right]; arr[right] = temp; left++; right--; } } return new String(arr); } } Leetcode · String · Java · JavaScript ·
🌐
LeetCode
leetcode.com › problems › reverse-vowels-of-a-string
Reverse Vowels of a String - LeetCode
Reverse Vowels of a String - Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.
🌐
AlgoMap
algomap.io › problems › reverse-string
Reverse String - Leetcode Solution
The optimal way to reverse a string in-place is by using the two-pointer technique.
🌐
Ruairidh
ruairidh.dev › string-reversal-in-javascript
String Reversal in Javascript | Ruairidh Codes
Then we loop through the string we receive using an ES6 for...of loop (see the docs) and pushing each character to the reversed string. So if we had hello then we would loop through and add h to a blank string. Then our next character is e which would be added to our string which has now become eh. Run in sequence you get: ... This is pretty straighforward and has a time complexity of O(n). Reduce is a Javascript array method which is really useful.
🌐
YouTube
youtube.com › watch
Reverse String || Leetcode Problem 344 || JavaScript Solution || Gavik Code - YouTube
Reverse String || Leetcode Problem 344 || JavaScript Solution || Gavik Code@vionalacademytech LeetCode JavaScript Playlist : https://youtube.com/playlist?lis...
Published   October 26, 2024
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › reverse-words-in-a-given-string
Reverse words in a string - GeeksforGeeks
Reverse the entire string, then iterate through it to extract words separated by dots. Reverse each word individually and update the original string until the end is reached.
Published   October 29, 2025
🌐
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.