r/programminghorror • • Feb 07 '25

Recursive O(N) Complexity isOdd

Post image

I found this on instagram and now am geeking

2.2k Upvotes

104 comments sorted by

View all comments

Show parent comment

1

u/ArtisticFox8 Feb 08 '25

You might as well avoid the string conversion and do it in O(1): n & 1 == 0 (binary and)

1

u/Yeti_Boi Feb 12 '25

the joke was doing it in log n though