Yahoo India Web Search

Search results

  1. 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.

  2. Nov 8, 2016 · 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 with O(1) extra memory. Example 1: Input: s = ["h","e","l","l","o"] Output: ["o","l","l","e","h"] Example 2: Input: s = ["H","a","n","n","a","h"]

  3. 344. Reverse String. Time: O (n) O(n) Space: O (1) O(1) C++ Java Python. 1 2 3 4 5 6 7 8 9 10. class Solution { public: void reverseString(vector<char>& s) { int l = 0; int r = s.size() - 1; while (l < r) swap(s[l++], s[r--]); } }; LeetCode Solutions in C++20, Java, Python, MySQL, and TypeScript.

  4. Mar 31, 2022 · Reverse String - 3 Ways - Leetcode 344 - Python. 🚀 https://neetcode.io/ - A better way to prepare for Coding Interviews 🥷 Discord: / discord 🐦 Twitter: / neetcode1 🐮 Support the ...

  5. View victoiremigashane's solution of Reverse String on LeetCode, the world's largest programming community.

  6. 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 with O (1) extra memory. Example 1: Input: s = ["h","e","l","l","o"] Output: ["o","l","l","e","h"] Example 2:

  7. 344. Reverse String. Easy. 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 with O (1) extra memory. class Solution: def reverseString(self, s: List[str]) -> None: s.reverse()