File: root - text - article - 2019 - 12 - reverse-words-in-a-string.txt.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 504 Views, 22906 Search Bots | 102 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 504 Views, 22906 Search Bots | 102 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by Facebook:
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "The cat in the hat"
Output: "ehT tac ni eht tah"
Note: In the string, each word is separated by single space and there will not be any extra space in the string.
Here's a starting point:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 504 Views, 22906 Search Bots | 102 Words Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "The cat in the hat"
Output: "ehT tac ni eht tah"
Note: In the string, each word is separated by single space and there will not be any extra space in the string.
Here's a starting point:
class Solution:
def reverseWords(self, str):
# Fill this in.
print Solution().reverseWords("The cat in the hat")
# ehT tac ni eht tah
Related Articles
- Daily Interview Problem: Maximum Profit From Stocks
- Making a Height Balanced Binary Search Tree
- Algorithm Interview Question: H-Index
- Find the non-duplicate number
- Daily Interview Problem: Longest Substring With K Distinct Characters
- Daily Interview Problem: Product of Array Except Self
- Daily Interview Puzzle: Intersection of Linked Lists
- Daily Interview Problem: Merge List Of Number Into Ranges
- Windows Scripting
- Palindrome Integers
©2006~2024 SteakOverCooked - 0.00812 Seconds(s) - 2426.016 KB/s - 24 Online Memory: 492.96 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !