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

Related Articles

  1. Daily Interview Problem: Word Ordering in a Different Alphabetical Order
  2. Most Frequent Subtree Sum
  3. Algorithm Interview Question: Nth Fibonacci Number
  4. Daily Interview Problem: Group Words that are Anagrams
  5. [Daily Problem] Remove k-th Last Element From Linked List
  6. Daily Interview Puzzle: Ways to Traverse a Grid
  7. Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
  8. Daily Interview Problem: Given two arrays, write a function to compute their intersection.
  9. Progess made
  10. Algorithm Interview Question: Max and Min with Limited Comparisons

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