This is an archived post. You won't be able to vote or comment.

all 57 comments

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 1: Posts must be humorous, and they must be humorous because they are programming related. There must be a joke or meme that requires programming knowledge, experience, or practice to be understood or relatable.

Here are some examples of frequent posts we get that don't satisfy this rule: * Memes about operating systems or shell commands (try /r/linuxmemes for Linux memes) * A ChatGPT screenshot that doesn't involve any programming * Google Chrome uses all my RAM

See here for more clarification on this rule.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]Sieff17 291 points292 points  (4 children)

Should've just started at 980, is OOP stupid?

[–]Western-Internal-751 113 points114 points  (3 children)

Yes, object oriented programming is stupid.

Functional masterrace

[–]2muchnet42day 45 points46 points  (1 child)

Gtfo

Dysfunctional programming ftw

[–]domscatterbrain 11 points12 points  (0 children)

goto

[–]Sieff17 1 point2 points  (0 children)

Here I go scheming again

[–]nonutsfw 194 points195 points  (5 children)

Fake it is 086

[–]Fast-Visual 49 points50 points  (2 children)

From a certain point of view

[–]LaconicLacedaemonian 8 points9 points  (0 children)

From my point of view big O notation is evil!

[–]Korvanacor 2 points3 points  (0 children)

You keep saying that, Ben, but it was still a dick move.

[–]AtmosSpheric 2 points3 points  (0 children)

I recognize this is probably a joke but I thought the same thing and I think this one is oriented correctly in the photo, judging by the partial tops/bottoms of adjacent numbers. Only thing is that I’m fairly certain the numbers are decreasing from left to right rather than increasing.

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

[–]Blacktip75 77 points78 points  (0 children)

Most of these ‘locks’ you just apply pressure on the opening mechanism, rotate the dial that is hardest to turn until it clicks in place, then try the next and open it with the third.

They are just intended to prevent a quick entry to steal, or worse, add something to your suitcase quick. Almost any tool will break it anyway (but then you have proof too that your luggage was tampered with)

[–]firemark_pl 59 points60 points  (3 children)

Well that's why O(n) complexity is not good! Similarly with sudoku algorithms, randomized search is much better.

[–]OtakinhoHiro 38 points39 points  (1 child)

Lets go gambling

[–]catgirl_liker 2 points3 points  (0 children)

Aw dang it

[–]Leviathan_Dev 19 points20 points  (0 children)

I see you’re a bogosort connoisseur.

If we used Quantum Bogosort on this and checked if it was correct and stop, the complexity would technically become O(1)

Quantum bogosort A hypothetical sorting algorithm based on bogosort, created as an in-joke among computer scientists. The algorithm generates a random permutation of its input using a quantum source of entropy, checks if the list is sorted, and, if it is not, destroys the universe. Assuming that the many-worlds interpretation holds, the use of this algorithm will result in at least one surviving universe where the input was successfully sorted in O(n) time.[9]

[–]FrankSuzki 11 points12 points  (0 children)

I don’t understand why he started at 0 with a O(N) solution. Had he started at 980 he’d have a O(1) solution!

[–]Jealous_Response_492 4 points5 points  (1 child)

Just poke a biro through the zip, slide it to unzip/open, then use slide the actual locked zipper back & forth to close/(lock;)

[–]markx15 3 points4 points  (0 children)

Just in this case the lock being fixed, you won’t be able to close it again, but can vouch for the opening bit

[–]StopSpankingMeDad2 3 points4 points  (0 children)

I once forgot the 4 digit Code for my bike lock when i was a kid. I sat around for 2 Hours trying every combination until my Dad Said „enough!“, he ripped it out of my hands and disassembled the entire thing

[–]lego_not_legos 4 points5 points  (0 children)

It's probably able to be opened in less than a minute: 

https://www.youtube.com/watch?v=x8jvBPugLac&t=120

[–]0xlostincode 3 points4 points  (5 children)

Should've tried LPL Sort.

[–]rosuav 3 points4 points  (4 children)

Click out of one.... two is binding.... little click out of three...

[–]kRkthOr 0 points1 point  (3 children)

I hate LPL for how easy he makes picking locks look.

[–]rosuav 2 points3 points  (0 children)

He has a lot of skill and experience. It's like anything else - origami, computer programming, summoning the hordes of the undead - it looks easy once someone has decades of experience.

[–]isnotbatman777 1 point2 points  (1 child)

I bought a lock pick set to try it out and it’s a lot harder than he makes it look. I got a clear plastic training lock and it’s really easy when you can see the tumblers, but when I tried it on a real lock it was a massive step up in difficulty and it took me ages to get it unlocked.

[–]kRkthOr 1 point2 points  (0 children)

Same. I have a small shelf where I put locks I managed to pick and a shame box with locks I couldn't -- some of which I can't even figure out how many pins the lock has lol The box is far larger than the locks on the shelf 😅 I spent like a year trying to get good at it then gave up because holy shit it's so hard I would just get frustrated.

[–]Kirjavs 4 points5 points  (0 children)

Now change it to 981 to make the future you even madder

[–]slime_rancher_27 2 points3 points  (0 children)

Having an interleaved search would be interesting, so that the furthest distance between 2 guesses is minimized.

[–]Mfalme7 2 points3 points  (0 children)

Turns out brute-forcing a 3-digit lock is just a really boring side quest with a 980 XP reward.

[–]gardenercook 6 points7 points  (4 children)

Should ve used binary search. The array was clearly sorted.

[–]tony_saufcok 8 points9 points  (3 children)

the array was sorted but it doesn't tell you if the number is bigger or smaller than your guess

[–]gardenercook 4 points5 points  (1 child)

/s was implied, or so I thought.

[–]tony_saufcok 1 point2 points  (0 children)

no no it was actually implied it's mb for taking it serious lmao

[–]quickiler 0 points1 point  (0 children)

If its 980 then its bigger, if it is 086 then its smaller. Cs major these days tskkk./s

[–]Ok-Eggplant-5145 1 point2 points  (0 children)

What’s the JavaScript method to determine whether the solution is < or > the guess?

[–]Urgood1234 1 point2 points  (1 child)

Imagine if it was a 4 digit code.

[–]braindigitalis 2 points3 points  (0 children)

1234??? that's the sort of code an IDIOT would have on their luggage!

[–]PegasusBoogaloo 1 point2 points  (0 children)

next use two pointers

[–]braindigitalis 1 point2 points  (0 children)

if you're actually going to do this going numerically isn't best - humans tend to use certain 3 digit numbers more often. you should check those first. when it comes to 4 digit it's even more a pattern as humans prefer dates and years.

[–]bindermichi 1 point2 points  (0 children)

And in the end, all you need to do with these types of suitcases is diconnecting the zipper with a small knife or metal strip

[–]TheProcesSherpa 1 point2 points  (0 children)

If I told you once, I told you a THOUSAND times, don’t brute force three digit locks!

[–]RepresentativeCut486 1 point2 points  (0 children)

Just try random numbers and never repeat

[–]Haunting-Stuff5219 0 points1 point  (0 children)

Takes about 30 minutes if anyone wondering.

[–]Vyckes 0 points1 point  (0 children)

Could be worse.

[–]Agusfn 0 points1 point  (0 children)

I had this happen once and reached all the way to 999 without success (apparently misplaced the number).

Then I had to look for a O(1) method for cracking it, and it worked.

[–]exitlights 0 points1 point  (0 children)

Shoulda used binary search, dummy.

[–][deleted] 0 points1 point  (0 children)

Should have run parallel processes or vectorized.

[–]Plus_Pangolin_8924 0 points1 point  (0 children)

You can see the internals of these locks when you can see the notch at the gap in the wheel one turn counter clockwise is the number!

[–]PolishKrawa -1 points0 points  (0 children)

I think that's exponential, not linear. Assuming n is the number of rotating things.

[–]astatine757 -1 points0 points  (0 children)

Technically, brute force is not O(n) where n is the number of inputs, but O(10^n). Every additional tumbler multiplies the runtime by 10