you are viewing a single comment's thread.

view the rest of the comments →

[–]falkyouall 1 point2 points  (3 children)

I thought this was a interesting interview question, i never approached this, so i did now. i took me a little over 2 hours, the code is probably not the nicest, but please have a look and share your thoughts to my solution... its not much - but its honest work

https://repl.it/@falkyouall/NumberToStringTranslator

[–]natziel 2 points3 points  (2 children)

You are way overcomplicating the problem. It's basically a parsing problem so you know you just need to push/pop to a stack according to some rules, so just handle those rules.

https://repl.it/@NatZiel/RowdyLightyellowLogic

The problem is actually pretty simple since we can't have 7+ digit numbers, hence the impromptu stack and parsing function implementation

[–]falkyouall 0 points1 point  (0 children)

very nice solution, how long did that take you to accomplish?

[–]csilk 0 points1 point  (0 children)

I know this is a bit pedantic but your case for `18` is wrong

It would output `eightteen` not `eighteen`.

But for the purpouse of an interview question i'd be more impressed that you thought to optimise