Decode string problem (Python Interview)

preview_player
Показать описание
Watch someone try to solve the decode string problem in Python with a Snowflake engineer.

Рекомендации по теме
Комментарии
Автор

Sir was soo calm while she was making mistakes, she was always given ample time to rectify mistakes herself. Thank you sir 🙏 .

anandkumar-irzj
Автор

Half an hour for this ... Oo

Here, one possible solution (functional programming style ;-)):
```python
In [11]: input_string = "a2z2b4"

In [12]: expected_string =

In [13]: assert "".join(letter*(int(occr)+1) for letter, occr in zip(input_string[::2], input_string[1::2])) == expected_string
```

As many times mentioned (in the video) ... keep practicing ^^

yoyonel
Автор

def convert(inp):
outp = ''
tmp = ''
for i, x in enumerate(inp):
if x.isalpha():
outp = outp + x
tmp = x
else:
outp = outp + tmp*i
return outp

waterhill
Автор

If I was the interviewee, I would be happy with the interview experience, but dissatisfied with the quality of the written feedback (follow link in description to read). Especially given the website says to expect "detailed, actionable feedback". Two lines of very generic advice ("keep practicing" and "explain your approach before you start") is all she got. This was my the first video I watched from this channel, so I hope this is an aberration, but does not seem to be a strong example that should be showcased to bring in new business.

cjp
Автор

For once, I can fully enjoy the video. Her accent is clear and pleasant - if it was only her voice, this video could have made it to my ASMR playlist. lol

carlossegura
Автор

Thank you so much for speaking fluently!

dadaabiola
Автор

This is the simplified version of the original problem.. the original one on leetcode is quite harder.

ahmadtibi
Автор

def decode_string(input: str):
output = ""
for char in input:
if char.isalpha():
letter = char
output += char
continue
if char.isdigit():
output += letter * int(char)
return output

__Reaps
Автор

lol i completely forgot about enumerate so i created a help variable to count as im looping through the string :D

borispsalman
Автор

Wait? What! Why is "snowflake" term used here? A bit unprofessional.

LordHog
Автор

It's not right to call people snowflakes. Regardless of the type of work they do.

AbgarMusayelyan
Автор

lol, 40mins is too much.

def converter(inp):
l = []
for i in range(0, len(inp), 2):
l.extend(inp[i] * (int(inp[i + 1]) + 1))
return "".join(l)

manikantaraju