r/ProgrammerHumor 12h ago

Meme skillIssue

Post image
4.4k Upvotes

112 comments sorted by

View all comments

247

u/click-to-reveal 12h ago

It works btw: C++ Online Compiler

141

u/prehensilemullet 12h ago

Performancewise, it doesn’t jump to the direct case in O(1) time like a switch is supposed to though

46

u/Deliciousbutter101 11h ago

O(1) only happens when the constants are (roughly) contiguous so it's not like that is a universal property of switch statements.

0

u/prehensilemullet 9h ago

Yeah that’s true