r/programming • • May 09 '15

"Real programmers can do these problems easily"; author posts invalid solution to #4

https://blog.svpino.com/2015/05/08/solution-to-problem-4
3.1k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

10

u/elcapitaine May 09 '15

See the author's solution - they originally thought the same thing, but that's wrong. It doesn't work for all cases. https://blog.svpino.com/2015/05/08/solution-to-problem-4

I never said that you'll be hired if you know how to answer these problems, but I won't consider you if you can't.

Guess they should fire themselves. Problems like these are fine - I liked solving this one, but if you're looking for the right answer as opposed to trying to see how the interviewee approaches problems you're interviewing wrong. This author comes across like an ass, and I'd never want to work for him.

2

u/psymunn May 09 '15

No, hpp3 is correct. The important part is HOW you pad the number. padding 123 with 0s to make it 1230000 doesn't work. Repeating the number does.

1

u/Phildos May 09 '15 edited Nov 12 '25

future quiet wakeful tender liquid cable friendly middle cover theory

This post was mass deleted and anonymized with Redact

1

u/psymunn May 09 '15

Here's the discussion boojum and I had about it. At the end of the day, his solution is really just the simplest. all he's doing is reducing the overall problem to the same comparison but for 2 numbers. It works because numbers will always have the same relative sorting, so you can sort them in any order.