To the Top
File:  root - text - article - 2019 - 12 - decode-string.txt.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 521 Views, 17824 Search Bots | 67 Words

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

Given a string with a certain rule: k[string] should be expanded to string k times. So for example, 3[abc] should be expanded to abcabcabc. Nested expansions can happen, so 2[a2[b]c] should be expanded to abbcabbc.

Your starting point:

def decodeString(s):
# Fill this in.

print decodeString('2[a2[b]c]')
# abbcabbc
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 521 Views, 17824 Search Bots | 67 Words Subscribe to Feed Burner

Related Articles

  1. Algorithm Interview Question: Nth Fibonacci Number
  2. Design Tic-Tac-Toe
  3. Daily Interview Problem: Reverse Words in a String
  4. Daily Interview Puzzle: Intersection of Linked Lists
  5. Daily Interview Problem: Queue Using Two Stacks
  6. Staying on a Chess Board
  7. Daily Interview Puzzle: Ways to Traverse a Grid
  8. Daily Interview Problem: Contiguous Subarray with Maximum Sum
  9. Daily Interview Puzzle: Falling Dominoes
  10. Non-decreasing Array with Single Modification

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" />