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 | 503 Views, 22861 Search Bots | 102 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 503 Views, 22861 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 | 503 Views, 22861 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: Largest Product of 3 Elements I
- Daily Interview Puzzle: Minimum Size Subarray Sum
- Maximum In A Stack
- Progess made
- Algorithm Interview: Convert Roman Numerals to Decimal
- Daily Interview Problem: Min Range Needed to Sort
- Algorithm Interview: Longest Consecutive Sequence
- Spreadsheet Columns
- Daily Interview Problem: Reverse Integer
- Algorithm Interview: Level Order Traversal of Binary Tree
©2006~2024 SteakOverCooked - 0.99227 Seconds(s) - -19.555 KB/s - 42 Online Memory: 491.81 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="noindex, 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 !