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 | 816 Views, 21889 Search Bots | 67 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 816 Views, 21889 Search Bots | 67 Words
| 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 | 816 Views, 21889 Search Bots | 67 Words 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
Related Articles
- Algorithm Interview Question: H-Index
- Maximum In A Stack
- Daily Interview Puzzle: Minimum Size Subarray Sum
- Daily Interview Problem: Merge List Of Number Into Ranges
- Daily Interview Problem: First Missing Positive Integer
- [Daily Problem] Longest Palindromic Substring
- Most Frequent Subtree Sum
- Daily Interview Problem: Maximum Profit From Stocks
- Spreadsheet Column Title
- Progess made
©2006~2024 SteakOverCooked - 0.00904 Seconds(s) - 1961.118 KB/s - 46 Online Memory: 491.02 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 !