Dev Duel
C++ Challenges
Work on variables, loops, functions, OOP, and problem-solving.
Filter challenges
Narrow down by difficulty or category.
All challenges
Practice concepts, improve problem-solving, and build confidence.
Reverse a String Without Built-Ins
Reverse a string manually without using built-in reverse helpers.
Calculate the Factorial of a Number in C++
Learn how to write a function that calculates the factorial of a given non-negative integer using C++.
Refactor Messy Inventory Management Code
Improve the structure and readability of a cluttered C++ function that manages inventory updates while preserving its original behavior.
Predict the Output of a Simple Loop and Conditional in C++
Analyze the given C++ code involving a loop and conditional statements, and predict the exact output it produces when run.
Predict Output of Complex Recursive and Bitwise Operations in C++
Analyze a complex C++ program that uses recursion combined with bitwise operations and tricky short-circuit logic. Predict the exact output produced by the program without running it.
Fix the Bug in a C++ Function to Calculate Factorial
Identify and fix the bug in a simple C++ function intended to calculate the factorial of a given number. The function currently produces incorrect output for some inputs.
Implement a Thread-Safe Memoization Function in C++
Build a reusable templated function that memoizes results of expensive computations in a thread-safe manner using modern C++ features.
Fix the Bug in Counting Even Numbers in an Array
Identify and fix the bug in the given C++ function that is supposed to count the number of even numbers in an integer array.
Build a Function to Rotate Elements in an Array
Write a C++ function that rotates the elements of an array to the right by a given number of steps. The rotation should handle cases where the number of steps is larger than the array size.
Simple Contact List Manager in C++
Create a basic contact list manager where users can add, display, and search contacts using console input and output.
Refactor Complex C++ Class for Improved Readability and Maintainability
Given a complex and messy C++ class implementation, refactor the code to improve readability, maintainability, and follow best OOP practices without changing the program's behavior.
Implement a Custom Memoized Recursive Function for Large Fibonacci Numbers
Write an optimized C++ function to compute Fibonacci numbers using memoization. The function must efficiently handle very large inputs by caching intermediate results to avoid exponential time complexity, showcasing mastery of recursion, dynamic programming, and function optimization.
Refactor Messy Loop and Conditionals in C++
Improve the readability and maintainability of a C++ function that calculates the sum of even numbers in a vector. Keep its behavior exactly the same while cleaning up the code.
Build a Function to Merge and Sort Two Arrays
Write a C++ function that takes two integer arrays as inputs, merges them into a single array, removes duplicates, and returns the sorted result.
Build a Function to Calculate the Area of a Rectangle
Write a simple C++ function that calculates the area of a rectangle given its width and height.
Build a Function to Rotate a Vector by k Positions
Write a C++ function that takes a vector of integers and an integer k, and returns the vector rotated to the right by k positions. This exercise tests your understanding of vector manipulation, modular arithmetic, and function implementation.
Fix the Bug in a Simple Temperature Converter
Debug a basic C++ function that is supposed to convert temperatures from Celsius to Fahrenheit but currently produces incorrect results.
Build a Simple Inventory Management System in C++
Create a console-based inventory management mini-project using C++. Implement features to add, update, delete, and display items stored in an inventory using vectors and classes.
Simple Task Tracker Mini-Project in C++
Build a basic console-based task tracker app in C++ that allows users to add, view, and remove tasks. Practice working with vectors, loops, and conditionals while creating a helpful daily tool.
Build a Function to Compute Running Median from a Stream of Integers
Write a C++ function that accepts a vector of integers representing a stream of numbers and returns a vector containing the running median after each new number is added.
Implement a Memoized Recursive Function to Compute the nth Catalan Number
Create an efficient C++ function that calculates the nth Catalan number using recursion with memoization. Catalan numbers appear in various combinatorial problems and grow quickly, so naive recursion is inefficient for larger inputs.
Basic Calculator CLI Mini-Project in C++
Create a simple command-line calculator program in C++ that performs basic arithmetic operations like addition, subtraction, multiplication, and division based on user input.
Advanced Multithreaded File Processing and Data Aggregation in C++
Create a performant C++ application that reads multiple large text files concurrently, processes the extracted data to compute aggregate statistics, and outputs a sorted summary report.
Advanced Portfolio Management System in C++
Create a mini-project to design and implement a portfolio management system that tracks multiple investment assets, calculates real-time portfolio value, and supports transaction history and performance analysis.
Predict the Output of a Complex Nested Loop with Conditional Logic in C++
Analyze the given C++ code that uses nested loops with conditional statements to manipulate variables. Predict the output without running the code.
C++ Student Grade Management System
Build a mini-project that manages student grades by storing names and scores, calculating averages, and allowing queries for top students.
Refactor a Complex C++ Matrix Multiplication with Thread Safety and Performance in Mind
Improve a messy and inefficient C++ matrix multiplication code by refactoring it to enhance readability, performance, and thread safety while preserving its original functionality.
Advanced C++ Code Refactor: Optimize and Modernize Complex Class Implementation
Given a legacy C++ class with complex logic, repetitive code, and poor maintainability, your task is to refactor it for readability, efficiency, and modern C++ best practices without altering its external behavior.
Refactor a Simple Grade Calculator for Clarity
Improve the readability and structure of a basic C++ grade calculation function without changing its behavior.
Predict the Output: Multi-dimensional Array and Pointer Arithmetic in C++
Analyze the provided C++ code snippet involving multi-dimensional arrays and pointer arithmetic. Predict the output without running the code.
Build a Simple To-Do List Application in C++
Create a beginner-friendly console-based to-do list app where users can add, view, and remove tasks.
Advanced C++ Mini-Project: Multi-Threaded Task Scheduler with Prioritization
Build an advanced multi-threaded task scheduler in C++ that accepts tasks with different priorities, efficiently manages a thread pool, and executes tasks in priority order. The scheduler should support adding, cancelling, and monitoring tasks in real-time.
Simple Budget Tracker
Create a basic C++ program that helps track expenses and calculate the remaining budget. Users will input their total budget and then enter expenses one by one. The program will output the remaining budget after each expense and a summary at the end.
Predict the Output of Complex Pointer and Reference Manipulations in C++
Analyze the given C++ code involving multiple levels of pointers, references, and pre/post-increment operators. Predict the exact output after all manipulations, demonstrating deep understanding of pointer arithmetic, reference binding, and operator precedence.
Build a Function to Perform Multi-level Memoized Matrix Chain Multiplication
Implement an optimized function to compute the minimum number of scalar multiplications needed to multiply a given chain of matrices using memoization to achieve efficient performance.
Build a Function to Calculate the Running Median of an Integer Stream
Write a function in C++ that processes a stream of integers and returns the median after each new number is added. The function should efficiently handle the insertion and calculation steps to provide medians dynamically.
Refactor Complex C++ Banking System for Maintainability and Performance
Refactor the provided C++ code of a banking system that handles multiple account types, transactions, and interest calculations. The goal is to improve code quality, maintainability, and performance without changing the system's behavior.
Fix Memory Leak and Logic Bug in Custom Linked List Implementation
Identify and fix the memory management and logic bugs in a custom singly linked list class implemented in C++. The list supports insertion and search operations but has subtle issues causing memory leaks and incorrect behavior.
Employee Performance Tracker
Build a C++ program to manage and analyze employee performance data by storing, updating, and calculating key statistics from the data.
Fix the Logic Bug in the Array Frequency Counter
The given C++ function is intended to count the frequency of each integer in an input vector and return the result as a map. However, the current implementation produces incorrect frequency counts due to a logic bug. Your task is to identify and fix the bug so that the function returns accurate counts.