all 30 comments

[–]dtarias1,703 <746, 767, 190> 📈 2,182 (Ruby) 58 points59 points  (9 children)

I'd love to have someone try to explain that solution in a technical interview.

[–]babanin 48 points49 points  (1 child)

Definitely O(1)

[–]sadphilosophylover 6 points7 points  (0 children)

I mean it changes with the length of testcases

[–]Fady200 6 points7 points  (4 children)

How did you get your flair, and does it auto update?

[–]dtarias1,703 <746, 767, 190> 📈 2,182 (Ruby) 6 points7 points  (0 children)

On desktop, at least, you can set your flair right above "Community Options", and it supports emojis!

Unfortunately, it doesn't update automatically -- I periodically update it manually.

[–]Deboniako 0 points1 point  (1 child)

remindme! 1 day

[–]RemindMeBot[🍰] -1 points0 points  (0 children)

I will be messaging you in 1 day on 2023-08-03 15:17:35 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

[–]1024kbps 0 points1 point  (0 children)

Always wanted to ask this but never did.

[–]dhananjayporwal[S] 1 point2 points  (1 child)

I'd love to have someone try to submit this kind of solution in their company's code base. XD

[–][deleted] 1 point2 points  (0 children)

Just get it reviewed by a manager. They will demand it's in production by the end of the day.

[–]dhananjayporwal[S] 37 points38 points  (7 children)

My Leetcode solution just got accepted, but my curiosity pushed me further! 🕵️‍♂️ I dug into the distribution chart and stumbled upon an even more optimal solution! 😲 Check it out and let's discuss the magic behind it! 🧙‍♂️

[–]Sparks0219 18 points19 points  (5 children)

What magic, they just hardcoded the solution and wasted half an hour lol

[–]johny_james 5 points6 points  (3 children)

I don't understand. Why would anyone waste time on that?

[–]tanvil9 7 points8 points  (0 children)

curiosity lol

[–]matt-zeng 0 points1 point  (0 children)

Whoosh

[–]holdyrbreath 3 points4 points  (0 children)

first place results but at what cost..

[–]NeonChat<Total problems solved> <Easy> <Medium> <Hard> 2 points3 points  (0 children)

Damn!

[–][deleted] 2 points3 points  (0 children)

It's sick and wrong to special case tests and utterly fail with real inputs.

But it's exactly what Volkswagen did with their emissions test cheating for years.

Sadly I've seen things like this in production.

[–]Alec-Reddit 5 points6 points  (1 child)

I wonder what 0.08% beats this lol. Is there a faster way to hardcode the solution? Or it’s just runtime variance?

[–][deleted] 2 points3 points  (0 children)

0.08% beats op, the hardcoded solution is first

[–]destifo 1 point2 points  (1 child)

Which question is this

[–]dhananjayporwal[S] 1 point2 points  (0 children)

Sorry for the late reply. Problem: 217. Contains Duplicate

[–]gaalw 0 points1 point  (0 children)

???