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 | 688 Views, 17700 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 | 688 Views, 17700 Search Bots | 117 Words Subscribe to Feed Burner

Related Articles

  1. [Daily Problem] Move Zeros
  2. Daily Interview Problem: Running Median
  3. Daily Interview Problem: First Missing Positive Integer
  4. Daily Interview Problem: Count Number of Unival Subtrees
  5. Algorithm Interview Question: Symmetric k-ary Tree
  6. Spreadsheet Column Title
  7. Algorithm Interview Question: Find the Single Element in an Array of Duplicates
  8. Algorithm Interview: Level Order Traversal of Binary Tree
  9. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  10. Daily Interview Problem: Distribute Bonuses

Comments (0)

    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="index, follow">