To the Top
File:  root - text - article - 2019 - 11 - falling-dominoes.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 428 Views, 13735 Search Bots | 117 Words

Subscribe to Feed Burner | Browse | Archive
Hi, here's your problem today. This problem was recently asked by Twitter:

Given a string with the initial condition of dominoes, where:

. represents that the domino is standing still
L represents that the domino is falling to the left side
R represents that the domino is falling to the right side

Figure out the final position of the dominoes. If there are dominoes that get pushed on both ends, the force cancels out and that domino remains upright.

Example:
Input: ..R...L..R.
Output: ..RR.LL..RR
Here is your starting point:


class Solution(object):
def pushDominoes(self, dominoes):
# Fill this in.

print Solution().pushDominoes('..R...L..R.')
# ..RR.LL..RR
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 428 Views, 13735 Search Bots | 117 Words Subscribe to Feed Burner

Related Articles

  1. Number of Ways to Climb Stairs
  2. Two-Sum
  3. [Daily Problem] Remove Consecutive Nodes that Sum to 0
  4. Plus One
  5. Daily Interview Problem: Trapping Rainwater
  6. Find Pythagorean Triplets
  7. Algorithm Interview: String Compression
  8. Compare Version Numbers
  9. CVE-2015-8874 - cPanel EasyApache Vulnerabilities
  10. A trick for getting good at coding interviews FASTER

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: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />