FizzBuzz
Print the numbers 1 through 20. Replace multiples of 3 with Fizz, multiples of 5 with Buzz, and multiples of both with FizzBuzz.
Example and solutions →Practice fundamentals, data structures, recursion, graphs, and dynamic programming. Each compact problem page includes a worked example, strategy, complexity, and runnable language tabs.
Start with the fundamentals
Practice loops, conditions, strings, arrays, arithmetic, and direct data-structure operations before moving into multi-step algorithms.
Print the numbers 1 through 20. Replace multiples of 3 with Fizz, multiples of 5 with Buzz, and multiples of both with FizzBuzz.
Example and solutions →Generate the first 10 Fibonacci numbers, starting with 0 and 1.
Example and solutions →Calculate n! for an integer from 0 through 20. For example, 5! equals 5 × 4 × 3 × 2 × 1.
Example and solutions →Determine whether a phrase reads the same forward and backward while ignoring spaces, punctuation, and letter case.
Example and solutions →Check whether an integer is prime: greater than 1 and divisible only by 1 and itself.
Example and solutions →Reverse the characters in a string without calling Array.Reverse.
Example and solutions →Check whether two phrases contain the same letters in a different order, ignoring spaces, punctuation, and case.
Example and solutions →Find the largest number in a non-empty integer array without sorting it.
Example and solutions →Return the index of a target in a sorted integer array, or -1 when the target is absent.
Example and solutions →Sort an integer array in ascending order using bubble sort.
Example and solutions →Determine whether an integer is even or odd, including when the value is negative.
Example and solutions →Calculate the sum of all integers in an array without using LINQ.
Example and solutions →Count the English vowels in a string without treating uppercase and lowercase letters differently.
Example and solutions →Add the decimal digits of an integer. Ignore the sign when the value is negative.
Example and solutions →Print the first 10 multiples of a given integer in equation form.
Example and solutions →Determine whether a year is a leap year under the Gregorian calendar rules.
Example and solutions →Find the greatest common divisor of two integers, treating negative inputs as their absolute values.
Example and solutions →Convert a non-negative decimal integer to its binary representation without using Convert.ToString.
Example and solutions →Return the first index of a target value in an unsorted integer array, or -1 if it is absent.
Example and solutions →Find the second-largest distinct integer in an array without sorting it. Reject arrays that do not contain two distinct values.
Example and solutions →Sort an integer array in ascending order using selection sort.
Example and solutions →Sort an integer array in ascending order using insertion sort.
Example and solutions →Convert a temperature from degrees Celsius to degrees Fahrenheit.
Example and solutions →Count how many times a target character occurs in a string while ignoring letter case.
Example and solutions →Remove spaces, tabs, line breaks, and other whitespace characters from a string.
Example and solutions →Find the smallest integer in a non-empty array without sorting the array.
Example and solutions →Calculate the arithmetic mean of a non-empty integer array and return a floating-point result.
Example and solutions →Count how many values in an integer array are positive, negative, or zero.
Example and solutions →Swap two integer variables by passing them to a method by reference.
Example and solutions →Calculate a base raised to a non-negative integer exponent without using Math.Pow.
Example and solutions →Reverse the decimal digits of an integer while preserving its sign and dropping leading zeroes from the reversed result.
Example and solutions →Count whitespace-separated words in a string, treating consecutive whitespace characters as one separator.
Example and solutions →Convert a space-separated phrase to title case by uppercasing each word's first letter and lowercasing its remaining letters.
Example and solutions →Remove repeated characters from a string while preserving the first occurrence of each character.
Example and solutions →Find the longest alphanumeric word in a sentence. If several words tie, return the first one.
Example and solutions →Return the distinct values found in both integer arrays, preserving their first-occurrence order in the first array.
Example and solutions →Determine whether an integer array contains any value more than once.
Example and solutions →Move all zero values to the end of an integer array in place while preserving the order of non-zero values.
Example and solutions →Rotate a non-empty string left by a given number of positions, allowing positions larger than the string length.
Example and solutions →Check that a password has at least eight characters, contains uppercase, lowercase, and digit characters, and contains no whitespace.
Example and solutions →Convert a valid Roman numeral using I, V, X, L, C, D, and M to its integer value.
Example and solutions →Return the number of days in a Gregorian calendar month for a given year, including leap-year February.
Example and solutions →Calculate the average of a non-empty set of numeric grades without losing the fractional part.
Example and solutions →Calculate the Euclidean distance between two points in a two-dimensional coordinate plane.
Example and solutions →Sum all positive integers below a limit that are divisible by 3 or 5, counting shared multiples only once.
Example and solutions →Calculate the nth triangular number, the sum of all integers from 1 through a non-negative n.
Example and solutions →List every positive divisor of a positive integer in ascending order.
Example and solutions →Determine whether a positive integer equals the sum of its positive divisors excluding itself.
Example and solutions →Count how many 1 bits appear in the binary representation of a non-negative integer.
Example and solutions →Extract the digits from an input string and format exactly ten digits as (XXX) XXX-XXXX.
Example and solutions →Combine the patterns
Apply stacks, graphs, trees, recursion, backtracking, greedy algorithms, and dynamic programming to more involved tasks.
Given an integer array and target, return the indexes of two different values whose sum equals the target.
Example and solutions →Check whether every opening parenthesis, square bracket, and brace is closed in the correct order.
Example and solutions →Combine two sorted integer arrays into one sorted array without sorting the result afterward.
Example and solutions →Remove duplicate integers from an array while keeping the first occurrence of each value in its original order.
Example and solutions →Count how often each word appears in a sentence, ignoring punctuation and letter case.
Example and solutions →An array contains distinct values from 0 through n with one value missing. Find the missing value.
Example and solutions →Move three disks from peg A to peg C using peg B, moving one disk at a time and never placing a larger disk on a smaller one.
Example and solutions →Reverse a singly linked list in place and return its new head.
Example and solutions →Find the fewest edges between two vertices in an unweighted graph.
Example and solutions →Given coin denominations and a target amount, find the minimum number of coins needed, or -1 if the amount cannot be formed.
Example and solutions →Rotate an integer array to the right by k positions in place. Values shifted past the end must wrap to the front.
Example and solutions →Transpose a rectangular integer matrix so that each original row becomes a column.
Example and solutions →Compress consecutive runs of the same character by writing the character followed by its run length.
Example and solutions →Return the first character that occurs exactly once in a string, or an empty string when every character repeats.
Example and solutions →Find the length of the longest contiguous substring whose characters are all distinct.
Example and solutions →Find the largest possible sum of a non-empty contiguous subarray.
Example and solutions →Merge all overlapping closed intervals and return the smallest equivalent set of non-overlapping intervals.
Example and solutions →Group words that are anagrams while preserving the order in which groups and words first appear.
Example and solutions →Determine whether a singly linked list contains a cycle without storing every visited node.
Example and solutions →Calculate the height of a binary tree as the number of nodes on its longest root-to-leaf path. An empty tree has height zero.
Example and solutions →Return the values of a binary tree in left-subtree, root, right-subtree order.
Example and solutions →Recolor the connected region containing a starting cell. Cells connect vertically and horizontally when they have the same original color.
Example and solutions →Generate every permutation of a string whose characters are distinct.
Example and solutions →Find the minimum number of single-character insertions, deletions, and replacements needed to transform one string into another.
Example and solutions →Choose items with given weights and values to maximize total value without exceeding a capacity. Each item may be used at most once.
Example and solutions →Sort an integer array in ascending order in place using the quicksort algorithm.
Example and solutions →Sort an integer array in ascending order using merge sort.
Example and solutions →Sort an integer array in ascending order in place using heap sort.
Example and solutions →Return a topological ordering of a directed acyclic graph, or reject the graph when it contains a cycle.
Example and solutions →Find the shortest distance from a start vertex to a target in a graph with non-negative edge weights.
Example and solutions →Join pairs of elements into groups and answer whether two elements belong to the same connected component.
Example and solutions →Find the lowest node in a binary search tree that is an ancestor of two given values known to exist in the tree.
Example and solutions →Return a binary tree's values from top to bottom and left to right within each level.
Example and solutions →Determine whether every node in a binary tree satisfies strict binary-search-tree ordering with no duplicate values.
Example and solutions →Serialize a binary tree into a comma-separated preorder string that includes markers for missing children.
Example and solutions →Insert lowercase words into a trie and determine whether any stored word starts with a requested prefix.
Example and solutions →Implement a fixed-capacity integer cache whose get and put operations evict the least recently used entry when necessary.
Example and solutions →Evaluate a space-separated postfix expression containing integers and the +, -, *, and / operators.
Example and solutions →Return the maximum value in every contiguous window of a fixed size as it moves across an integer array.
Example and solutions →For each integer array position, return the product of every other value without using division.
Example and solutions →Find the kth-largest value in an unsorted integer array without fully sorting the array.
Example and solutions →Find the length of the longest sequence of characters that appears in two strings in the same order, not necessarily contiguously.
Example and solutions →Find the length of the longest strictly increasing subsequence in an integer array.
Example and solutions →Determine whether a string can be segmented completely into one or more words from a supplied dictionary.
Example and solutions →Determine whether any subset of non-negative integers adds exactly to a non-negative target.
Example and solutions →Generate every well-formed string containing a requested number of matching parenthesis pairs.
Example and solutions →Find every combination of distinct positive candidate values that sums to a target, allowing each candidate to be reused.
Example and solutions →Count connected groups of land cells in a grid where land connects vertically and horizontally but not diagonally.
Example and solutions →Return the elements of a rectangular matrix in clockwise spiral order starting at the top-left corner.
Example and solutions →Rotate a square matrix 90 degrees clockwise in place.
Example and solutions →Common questions
Open one problem at a time, work from its example input, and attempt a solution before opening the language tabs. Then compare your reasoning and complexity with the worked answer.
Yes. Each of the 100 problems has one canonical page with a worked example, explanation, complexity analysis, verified output, and language solution tabs.
Yes. Every program was executed with the corresponding BuildQuill compiler runtime, and its displayed output matches the program result.
Yes. Every problem page has accessible language tabs, so you can compare syntax without switching to a duplicate page.