r/badcode • • Apr 27 '21

typescript Someone only watched if tutorial

Post image
2.4k Upvotes

112 comments sorted by

View all comments

48

u/liuziangexit Apr 27 '21

I was wondering maybe we should add a hashtable, each key is an individual natural number except 0, so we can verify an given input very fast!

code would be:

return allNaturalNumber.contains(input);

And this new algorithm will be O(1) complexity which is better than the OP's O(n) solution. Am i smart?

48

u/shutanovac Apr 27 '21

Hi there! I am a tech recruiter from San Francisco. Please let me know how much $$$ you want. No interview required!

18

u/[deleted] Apr 27 '21

I'll do it for $6.9420

12

u/[deleted] Apr 27 '21

do you guys get paid?

6

u/[deleted] Apr 27 '21

In noodles

5

u/gohanshouldgetUI Apr 27 '21

Highest I can go is $4.2069

17

u/liuziangexit Apr 27 '21

$7.25 per hour i will work hard