To the Top
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 | 192 Views, 16963 Search Bots | 102 Words

Subscribe to Feed Burner | 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:


class Solution:
def reverseWords(self, str):
# Fill this in.

print Solution().reverseWords("The cat in the hat")
# ehT tac ni eht tah
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 192 Views, 16963 Search Bots | 102 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Question: Edit Distance
  2. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  3. Print a tree level-by-level, with line-breaks
  4. Longest Substring Without Repeating Characters
  5. Top K Frequent words
  6. Algorithm Interview Question: Find the Single Element in an Array of Duplicates
  7. Daily Interview Problem: Given two arrays, write a function to compute their intersection.
  8. ImageMagick Vulnerabilities -  CVE-2016–3714
  9. Most Frequent Subtree Sum
  10. Daily Interview Problem: Deepest Node in a Binary Tree

Comments (0)

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">