Comment

Comment by martincmartin

you get a linear time O(n) isEven function

In complexity theory, the size of a problem is the number of bits to represent the input, so if the input integer is i, then the size is n = log_2(i) so the algorithm is actually exponential in the number of bits it takes to represent the input.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton