Stacks Questions
Stacks Questions
(Assignment Questions)
Examples :
Input: head = [1,2,2,1]
Output: true
The encoding rule is: k[encoded_string], where the encoded_string inside the
square brackets is being repeated exactly k times. Note that k is guaranteed to
be a positiveinteger.
You may assume that the input string is always valid; there are no extra white
spaces, square brackets are well-formed, etc. Furthermore, you may assume
that the original data does not contain any digits and that digits are only for
those repeat numbers, k. For example, there will not be input like 3a or 2[4]. [ Go
to Qs ]
Examples :
Input: s =
"3[a]2[bc]"
Output:
"aaabcbc"
Input: s =
"2[abc]3[cd]ef"
Output:
"abcabccdcdcdef
Examples :
Input: path =
"/home//foo/"Output:
"/home/foo"
Explanation: Multiple consecutive slashes are replaced by a single one.
https://telegram.me/+QGUyTripaP4zNTcx
https://telegram.me/+nEKeBr_yhXtmY2Yx
#TGSFamily