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 | 247 Views, 19065 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 | 247 Views, 19065 Search Bots | 102 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Problem: Min Range Needed to Sort
  2. Find Missing Numbers in an Array
  3. Daily Interview Problem: Merge Overlapping Intervals
  4. First and Last Indices of an Element in a Sorted Array
  5. [Daily Problem] Angles of a Clock
  6. Binary Tree Level with Minimum Sum
  7. Daily Interview Problem: Given two arrays, write a function to compute their intersection.
  8. Algorithm Interview: Determine If Linked List is Palindrome
  9. Algorithm Interview: Smallest Number that is not a Sum of a Subset of List
  10. Daily Interview Problem: Queue Using Two Stacks

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />