Join 4,000+ beginners who transformed into confident problem solvers with our carefully sequenced 150-problem curriculum.
One day, while teaching your little sibling about numbers, you wonder how a computer can tell if a number is even or odd. You recall that even numbers are divisible by 2 without a remainder, and odd numbers are not. To make it clear, you decide to write a simple program that checks the divisibility by 2 to classify any given number.
In a programming contest, you get a question: determine whether a given number is prime. You remember a prime number is a number greater than 1 that has no divisors other than 1 and itself. To solve this, you decide to check divisibility from 2 up to the square root of the number. This way, you can quickly find if any divisor exists and decide primality.
While developing a calendar app, you notice that some years have an extra day in February. You recall the leap year rule: a year is a leap year if it is divisible by 4, except if it is divisible by 100, unless it is also divisible by 400. To correctly mark these years, you decide to implement this logic and identify leap years.
Your math teacher challenges you to find the sum of the first N natural numbers. You recall the formula: sum = N * (N + 1) / 2. Instead of adding them one by one, you decide to write a program that uses this formula to quickly compute the sum for any given N.
While solving combinatorics problems, you need to calculate factorials of numbers. Factorial of a number N is the product of all positive integers less than or equal to N. To automate this, you decide to write a program that calculates factorials either iteratively or recursively.
You and your friend are trying to divide candies equally. To do that, you need to find the greatest common divisor (GCD) of two numbers. The Euclidean algorithm provides a fast way to calculate GCD by repeatedly subtracting or using the remainder operation. You decide to implement this to help with fair distribution.
While working on a text-based game, you need to reverse strings entered by players for a secret code. You decide to create a simple function that reverses any input string so that the game can process these secret messages.
You want to verify if a given string reads the same backward as forward — a palindrome. To do this, you decide to write a program that compares characters from both ends moving towards the center, confirming if the string qualifies as a palindrome.
While exploring patterns in nature, you get curious about the Fibonacci sequence — a series where each number is the sum of the two preceding ones. To help generate the sequence quickly, you decide to write a program that calculates the Nth Fibonacci number.
On a cold winter day, you want to convert temperatures from Celsius to Fahrenheit to understand the weather better. Using the formula F = (C × 9/5) + 32, you decide to implement a program that performs this conversion for any given Celsius temperature.
You’re given two ancient artifacts, each cursed to repeat at their own intervals. To break the cycle and align them perfectly, you must determine the earliest time both will align. In other words, find the Least Common Multiple (LCM) of two numbers.
You receive a mysterious message. To decode its tone—whether it's a whisper of vowels or a march of consonants—you must count how many vowels and consonants it contains.
A secret message has been encoded by reversing its characters. To reveal its true meaning, you must reverse the string back to its original form.
You stumble upon a list of magical stones, each with a power level. Your task is to find the most powerful and the weakest stone in the collection.
A chaotic set of scrolls needs to be organized in increasing order of their magic levels. Help the wizard sort this array of numbers in ascending order.
You’ve found a ledger of gold coins collected over time. Calculate the total treasure by summing all the entries in this array.
Legend says that certain numbers hold a self-loving property—equal to the sum of the cubes of their digits. Find all such 'Armstrong numbers' within a given range.
A student begins their journey into the realm of numbers. Their first task is to learn and master the multiplication table for any given number. Can you help them generate it?
A village elder seeks your help to find sacred prime numbers—those that can only be divided by 1 and themselves—within a specified range. Your task is to find them all.
In the kingdom of Numeria, legends speak of a mysterious Magical Triangle a figure said to hold great power if only its secret can be uncovered. This secret lies hidden in the sum of certain enchanted row IDs,You, a brave coder, have been entrusted with a set of these triangle IDs. The wise elders say that if the sum of these IDs forms a perfect square, then there’s a deeper magic to be found within its digits. Only if the hidden essence of this sum the greatest common divisor of its digits—reveals a prime number, will the triangle’s true power awaken, marking it as MAGICAL, Your quest is to determine whether the given triangle is truly MAGICAL or just an ordinary figure. Are you ready to uncover the ancient secret?
Imagine you are on a quest to find the treasure hidden among numbers. This treasure is the sum of all odd numbers that lie between two points on the number line. Given a range, your task is to gather all these odd numbers and calculate their total sum. Can you write a program that helps you uncover this hidden treasure?
In the world of sequences, the Fibonacci series is legendary, starting with 0 and 1, each number being the sum of the two before it. Your challenge is to find the Fibonacci number sitting at a specific position in this endless chain. Can you pinpoint the exact number that belongs there?
Prime numbers are the building blocks of all numbers, indivisible except by 1 and themselves. Your mission is to identify and list all such prime numbers that are smaller than a given number. Can you help reveal this secret list of prime guardians?
Numbers can be long or short, but what if you need to find out exactly how many digits make up a number? Like counting the soldiers in an army, your task is to count how many digits a number contains.
Some numbers are special—they are equal to the sum of their own digits each raised to the power of the number of digits. These are called narcissistic numbers. Your mission is to determine if a given number is one such narcissistic number.
Patterns tell stories in numbers. Your task is to generate a simple sequence of numbers arranged in rows, like filling up seats in a theater one by one, starting from 1 and going upwards.
The factorial of a number can be very large, but what if you want to know the sum of all its digits? Like breaking down a giant treasure chest into smaller gems, you must calculate the sum of the digits of the factorial.
Palindromes are magical strings that read the same forwards and backwards. Your task is to find the largest palindrome hidden inside a given string, like discovering a hidden mirror.
Sequences are expected to be complete, but sometimes numbers go missing along the way. Your task is to find all the missing numbers in a sequence that should run from 1 to n, like a detective filling in the gaps.
Pascal's Triangle is a beautiful triangular array where each number is the sum of the two numbers directly above it. Your task is to generate this triangle up to a given number of rows and reveal the mathematical magic hidden within.
In the realm of numbers, you are given an array filled with scattered values. Your task is to bring order by finding the median — the number sitting right in the middle once the array is sorted. Will you find the balance point that divides the array perfectly?
You stand before the classic challenge of exponents. Given a base and an exponent, compute the power — that is, multiply the base by itself exponent times. Can you harness this power efficiently?
Two strings walk into a room, and you must determine if they are anagrams — different arrangements of the same letters. Can you prove they are twins in disguise?
Between two numbers lies a hidden treasure: prime numbers. Your mission is to find all these primes in the given range and sum their value. Can you unlock this numeric bounty?
Imagine stacking objects to form a triangle. The N-th triangular number tells you how many objects you have stacked after N layers. Calculate this number and see the shape grow.
Is the given number a perfect square? That is, can it be expressed as another number multiplied by itself? Find out if this perfect symmetry exists.
Break the number into digits, square each digit, and then sum them all up. How large does this sum grow?
Given a size N, fill an N x N matrix with numbers starting from 1 and increasing sequentially. Can you create this perfect numeric grid?
Keep adding the digits of a number repeatedly until only a single digit remains. What is the final single-digit sum?
Given a string, reverse its characters so it reads backwards. How well can you flip the order?
You are tasked with writing a recursive function that prints the Fibonacci sequence up to a given number n. The sequence starts with 0 and 1, and each subsequent number is the sum of the previous two. Use recursion to elegantly generate this sequence until it reaches the desired length.
Given a positive integer, your goal is to find all the numbers that divide it evenly without leaving a remainder. This will help you practice iteration and modular arithmetic efficiently.
You are given an array of numbers, and your task is to compute their average. This problem will test your ability to traverse arrays and perform basic arithmetic operations.
Find the most frequent number in the array. If multiple numbers have the same highest frequency, return any one of them. This problem hones your skills in frequency counting and array traversal.
Given a string, determine its length without using any built-in length functions. This tests your understanding of string traversal and basic loops.
Print a pyramid where each row contains numbers starting from 1 up to the row number. For example, row 3 should print '123'. This pattern tests nested loops and string formatting.
Find the prime factors of a number and sum them. Prime factors are prime numbers that divide the number exactly. This problem combines factorization with prime checking.
Given an array, find the second largest number. Sorting the array or scanning twice can solve this. This is a classic problem testing array manipulation and sorting techniques.
Find the longest substring in a string that contains no repeating characters. Use sliding window or hash map techniques to efficiently find this substring.
Chef is trying to recover a lost message encoded as an array of positive integers. However, only some parts of the message are meaningful. Chef realizes that only the numbers at even indices (0-based) carry the actual information, and the rest are noise! Your task is to help Chef recover the message by summing up the values at all even indices in the given array.