Logo
All of Shakespeare fits in 5MB. Windows needs 20GB.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • Csharp Csharp
  • All Categories

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Hardcoded-solution Memes

Posts tagged with Hardcoded-solution

That's One Way To Do It I Guess...

Python Programming Debugging Testing Algorithms
3 hours ago 49.4K views 0 shares
That's One Way To Do It I Guess...
So someone decided to detect a cycle in a linked list by just... checking if the head node's value is the letter 'E'. And wrapping it in a try-except that returns False on any exception. This solution somehow beats 5.18% on runtime and 7.89% on memory, which means there are actually worse solutions out there. For context, the proper way to detect cycles uses Floyd's cycle detection algorithm (the tortoise and hare approach), which runs in O(n) time with O(1) space. But why bother with elegant algorithms when you can just hardcode a character check that probably only works for one specific test case? The try-except is the cherry on top—because when your logic is this questionable, you might as well catch literally everything that could go wrong. The real mystery is what kind of test suite allows this to pass as "Accepted" with a green checkmark. Someone's edge cases need an edge case.

Spotlight

GearScouts.com

Stop scrolling, start exploring! Find the gear that'll get you off the couch and into the wild. Compare power stations for off-grid adventures, flashlights for midnight hikes, and essentials that make the outdoors your playground. Get Outside →

LG UltraFine 31.5-Inch Computer Monitor 32UP83A...

LG UltraFine 31.5-Inch Computer Monitor 32UP83A...
Ad Your purchase helps maintain our 99.9% uptime. The other 0.1% is when we're updating npm. ⏱️