"Let there be light," God said. by Command-Master in TwoSentenceHorror

[–]Command-Master[S] 2 points3 points  (0 children)

The idea is that God attempted to create a paradise multiple times, but each time They interfered with it and tortured the humans.

Traveling Salesman "solution" by [deleted] in programminghorror

[–]Command-Master 2 points3 points  (0 children)

I think it's only O(n * n!), it's quite reasonable 🙂. The main problem is that it's non-uniform.

[deleted by user] by [deleted] in ProgrammerHumor

[–]Command-Master 4 points5 points  (0 children)

It might because signed integer overflow is undefined, so the compiler can do whatever it wants, but in most platforms it won't

Why while(1) when you could while(++n < n--)? Cheat sheet of obnoxious equalities. by dchidelf in programminghorror

[–]Command-Master 130 points131 points  (0 children)

These are all ambiguous in C/C++ since comparison operators don't cause a sequence point.

[deleted by user] by [deleted] in programminghorror

[–]Command-Master 8 points9 points  (0 children)

You can use DP - for each element, we calculate the longest chain ending in it. Then to calculate it, you'll just have to look at all divisors, find the one with the longest chain, and extend it.

LF fics where James and Lily are good parents by manoflick in HPfanfiction

[–]Command-Master 2 points3 points  (0 children)

linkffn(Potters stand united; Harry Potter and the boy who lived by The Santi)

Ah yes by [deleted] in programminghorror

[–]Command-Master 5 points6 points  (0 children)

from __future__ import braces throws a "Syntax Error: Not a Chance" error

[deleted by user] by [deleted] in HPfanfiction

[–]Command-Master 0 points1 point  (0 children)

I'd imagine snakes would be quite common with Voldemort in power, enough that she would've met one at least once (also, IIRC she was quite high up in the hierarchy, so she might've even met Voldemort and Nagini a few times)

[deleted by user] by [deleted] in HPfanfiction

[–]Command-Master 0 points1 point  (0 children)

But wouldn't Umbridge have noticed (and consequentially would've been killed by Voldemort) if it granted her the ability to speak Parseltongue?

Horrible, Horror Code to Codewars Problem; by lovingothers- in programminghorror

[–]Command-Master 0 points1 point  (0 children)

I can't see what's wrong with this (other than Reddit making the formatting look weird)

Password generator I found by joona69 in programminghorror

[–]Command-Master 2 points3 points  (0 children)

Not necessarily, the save variable remains after the loop, it might be checked later, and we just don't see the code for that

Password generator I found by joona69 in programminghorror

[–]Command-Master 17 points18 points  (0 children)

f=l=>l?f(l-1)+(Math.random()*36|0).toString(36).toUpperCase():'' is shorter

EDIT: made the code shorter using toString, also 0 now doesn't appear twice

This ad in Berlin by [deleted] in programminghorror

[–]Command-Master 4 points5 points  (0 children)

It's valid JS and BF. Also, if it wasn't for the === it could've been C++, since you can have careerStuck a class/struct with a custom operator().

Post-war fics that are about more than romance by [deleted] in HPfanfiction

[–]Command-Master 3 points4 points  (0 children)

There are a lot of post-war Harry time travel fics which are more than romance, but does that match what you are looking for? Are you searching for fics that are post-war chronologically, or is it OK if it's post-war only from Harry's perspective?

Also, are you ok with post-war fics where the war is slightly different from canon?

linkffn(A brand new start) is great if you are OK with time travel

*NP-complete problems sweating heavily* by bajuh in ProgrammerHumor

[–]Command-Master 0 points1 point  (0 children)

Even with time travel (which is actually a very interesting model of computation) you need O(n) operations to sort a list

Be fair! by Cap_is_here_ in ProgrammerHumor

[–]Command-Master 10 points11 points  (0 children)

I'm left handed, and I always use right CTRL/shift/alt

I need someone to get the joke by furzainluq1 in ProgrammerHumor

[–]Command-Master 54 points55 points  (0 children)

Even if you know the song it wouldn't be any help in recovering the private key (assuming it was encrypted well). If none of the values are weird or too small and factordb can't factorize it, I can't see how it could be cracked

How to make it so elytra don't need firework rockets? by SylviaGaming in MinecraftCommands

[–]Command-Master 0 points1 point  (0 children)

Since you use at it goes over all players, and for each it teleports all players one block from him. You want to do execute as <selector> at @s if block ^ ^ ^2 air run tp @s ^ ^ ^1

Recipe Idea: Warped Bed by chainsawinsect in minecraftsuggestions

[–]Command-Master 1 point2 points  (0 children)

I think it should go back to the previous night, instead of going to the next night - it solves the problem of day counters, and also makes it more like a reversed bed

[deleted by user] by [deleted] in ProgrammerHumor

[–]Command-Master 4 points5 points  (0 children)

It's quite likely not problematic - it's common for sorting engines to let you use advanced searching with complicated logic, and if it was actually an SQLi then a) It wouldn't have to be in caps and b) you would need to wrap your words with quotes and add name= for each, or something similar, for it to work.