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

Related Articles

  1. Daily Interview Problem: Reverse Integer
  2. 56 Bytes
  3. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  4. [Daily Problem] Witness of The Tall People
  5. [Daily Problem] Move Zeros
  6. [Daily Problem] Validate Balanced Parentheses
  7. Daily Interview Problem: Given two arrays, write a function to compute their intersection.
  8. [Daily Problem] Remove k-th Last Element From Linked List
  9. Spectrum Master
  10. Algorithm Interview: String Compression

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