File: root - text - article - 2019 - 11 - falling-dominoes.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 735 Views, 18611 Search Bots | 117 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 735 Views, 18611 Search Bots | 117 Words
| 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:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 735 Views, 18611 Search Bots | 117 Words 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
Related Articles
- Compare Version Numbers
- Daily Interview Problem: Largest Product of 3 Elements I
- Daily Interview Question: Create a Simple Calculator
- Algorithm Interview: Determine If Linked List is Palindrome
- Autorun.inf Virus Protection
- Daily Interview Problem: Longest Substring With K Distinct Characters
- Daily Interview Problem: Given two arrays, write a function to compute their intersection.
- [Daily Problem] Move Zeros
- Daily Interview Problem: Room scheduling
- Daily Interview Problem: Reverse Integer
©2006~2024 SteakOverCooked - 0.00759 Seconds(s) - 7149.158 KB/s - 31 Online Memory: 516.37 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !