FizzBuzz, precisely
Return a newline-separated string for 1..n: Fizz, Buzz, FizzBuzz, or the number.
Temperature converter
Convert Celsius to Fahrenheit: F = C × 9/5 + 32.
Even or odd?
Return 'even' or 'odd' for an integer.
Sum of digits
Return the sum of all decimal digits of a non-negative integer.
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.
Reverse a string
Return the characters of the string in reverse order.
Palindrome check
Return True if the string reads the same forwards and backwards (ignoring case and non-alphanumeric).
Count vowels
Count the number of vowels (a, e, i, o, u) in a string (case-insensitive).
Title case converter
Return the string with each word capitalised.
Anagram check
Return True if two strings are anagrams of each other.
Two Sum
Return indices (i, j) with i < j such that nums[i] + nums[j] == target.
Remove duplicates (sorted)
Return a sorted list with duplicates removed.
Merge two sorted arrays
Merge two sorted arrays into one sorted array.
Word frequency
Return a dict mapping each word to its count in the sentence.
List intersection
Return the sorted list of elements common to both lists.
First non-repeating character
Find the index of the first character that appears only once.
Most frequent element
Return the element that appears most often in a list.
Stack class
Implement a Stack class with push, pop, peek, is_empty, and size.
Valid parentheses
Return True if brackets in the string close in the correct order.
Binary search
Return the index of target in a sorted list, or -1 if not present.
Infinite counter generator
Create an infinite counter starting from `start`, stepping by `step`.
Showing 25 challenges · easy