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 | 507 Views, 17388 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 | 507 Views, 17388 Search Bots | 67 Words Subscribe to Feed Burner

Related Articles

  1. Fibonacci coding
  2. First and Last Indices of an Element in a Sorted Array
  3. Skip the readings, focus on problems. And use all the hints!
  4. Daily Interview Problem: Find the k-th Largest Element in a List
  5. Sorting a list with 3 unique numbers
  6. Plus One
  7. Daily Interview Problem: Minimum Removals for Valid Parenthesis
  8. Daily Interview Problem: Merge Overlapping Intervals
  9. Algorithm Interview: Convert Roman Numerals to Decimal
  10. Algorithm Interview: Smallest Number that is not a Sum of a Subset of List

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: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />