Collatz steps
Count how many steps the Collatz sequence takes to reach 1 from n.
Factorial (iterative)
Compute n! iteratively without recursion.
Power of two?
Return True if n is an exact power of 2.
GCD via Euclid
Compute the greatest common divisor of two positive integers.
Prime checker
Return True if n is a prime number.
Zigzag string conversion
Encode a string in zigzag order across numRows rows, then read row by row.
2D Vector dataclass
Implement a Vector2D dataclass with +, -, scalar *, dot product, and magnitude.
Showing 7 challenges