Dev Duel
Sharpen your skills with real coding challenges
Practice JavaScript, Python, SQL, and C++ with guided challenges built for beginners through advanced learners.
Daily Duel
Calculate Total Sales Per Employee Using SQL GROUP BY
Learn how to aggregate sales data by employee using the SQL GROUP BY clause and aggregate functions in this beginner-friendly challenge.
Browse by language
Choose a language and jump into practical challenges.
JavaScript
Practice fundamentals, arrays, functions, async logic, and debugging.
Explore challenges →Python
Sharpen syntax, loops, functions, lists, dictionaries, and more.
Explore challenges →SQL
Train with filtering, joins, grouping, subqueries, and window functions.
Explore challenges →C++
Work on variables, loops, functions, OOP, and problem-solving.
Explore challenges →Featured Duels
Start with strong practice problems across languages.
Sum Two Values
Write a function that returns the sum of two numbers.
Count Even Numbers
Count how many even numbers appear in a list.
Find the Second Highest Salary
Return the second highest salary from an employees table.
Reverse a String Without Built-Ins
Reverse a string manually without using built-in reverse helpers.
Calculate Total Sales Per Employee Using SQL GROUP BY
Learn how to aggregate sales data by employee using the SQL GROUP BY clause and aggregate functions in this beginner-friendly challenge.
Beginner Challenge: Create a Function to Capitalize the First Letter of Each Word
Practice string manipulation by writing a JavaScript function that capitalizes the first letter of every word in a given sentence.
Sum All Odd Numbers in a List
Write a function that calculates the sum of all odd numbers in a given list of integers.
SQL Beginner Challenge: Calculate Total Sales per Customer
Practice basic SQL aggregation by calculating the total sales amount for each customer in a sales database.
Simple To-Do List App in JavaScript
Create a basic to-do list application where users can add tasks, mark them as completed, and see the updated list.
Fix the Broken SELECT Query to Retrieve Employee Names
A simple SQL query intended to retrieve all employee names is not working correctly. Your task is to identify and fix the syntax errors so the query runs successfully and returns the correct results.
Build a SQL Function to Calculate Running Median Over a Dynamic Window
In this challenge, you will create a SQL function that calculates the running median value of a numeric column over a dynamic sliding window based on timestamps. This requires advanced use of window functions, array manipulation, and median calculation within SQL.
Design and Query a Library Management Data Model
Create a SQL data model for a library management system and write queries to retrieve meaningful information about books, authors, borrowers, and loans.
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.
Build a Decorator to Cache Function Results with Expiry
Create a Python decorator function that caches the results of an expensive function call, with support for automatic expiration of cached values after a given time-to-live (TTL).
Build a Todo List Manager with Filtering and Prioritization
Create a JavaScript function that manages a list of todo items, allowing for adding, removing, updating status, and filtering tasks based on their priority and completion status.
Fix Bug in Async Data Aggregation and Error Handling Function
Debug and fix a complex asynchronous JavaScript function designed to fetch and aggregate data from multiple APIs with error handling. The current implementation contains subtle bugs causing unhandled promise rejections and incorrect data aggregation.
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.
Build an Advanced Debounce Function with Immediate and Cancel Options
Create a robust debounce utility function in JavaScript that delays invoking a function until after a specified wait time elapses since the last call. Support both immediate execution on the leading edge and the ability to cancel a pending invocation.
Refactor SQL Query for Sales Aggregation Optimization
Improve the given SQL query that calculates total and average sales per product category. The original query uses multiple subqueries and redundant joins, causing inefficiencies. Refactor it to be cleaner and more performant while preserving the exact results.
Build a Movie Recommendation Engine Based on User Ratings
Create a Python mini-project that recommends movies to a user based on their past ratings and similarity to other users' ratings. Implement basic collaborative filtering logic without external libraries.
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.
Build a Simple To-Do List App
Create a basic to-do list application in JavaScript where users can add, view, and remove tasks. This project helps beginners practice working with arrays, functions, and DOM manipulation.
Predict the Output of an SQL Query with Subqueries and Joins
Analyze the given SQL query involving JOINs and a correlated subquery, and predict the final output based on a provided sample database schema and data.
Design and Implement a Scalable E-Commerce Order Tracking Data Model
Build a comprehensive SQL data model supporting order tracking, including customers, products, orders, shipments, and status history, ensuring efficient querying for complex business insights.
Create a SQL Function to Calculate Running Sales Total per Customer
Build a SQL function that calculates the running total of sales for each customer ordered by the sale date.
Refactor and Optimize Complex Data Processing Function
Given a large-function script that processes a nested data structure with redundant loops and poor readability, refactor the code to improve maintainability, reduce complexity, and optimize performance without changing its output.
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.
Predict the Output of Nested Array and Object Destructuring with Defaults
Analyze the given JavaScript code involving nested array and object destructuring with default values and predict the final output.
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.
Fix the Aggregation Bug in Employee Salary Report Query
An SQL query intended to generate a report summarizing total salaries by department and job title has incorrect aggregation logic causing wrong results. Your task is to identify and fix the bugs in the query to produce accurate aggregation.
Build a Function to Flatten a Nested List of Integers
Create a Python function that takes a nested list of integers and returns a flat list containing all the integers in their original order.
Build a Function to Serialize and Deserialize Nested Dictionaries with Custom Rules
Create a Python function to serialize a nested dictionary into a custom string format and another function to revert it back, handling complex nesting and type conversions.
Refactor and Improve Readability of a Data Filtering Function
Refactor a given Python function that filters and processes a list of dictionaries to improve its code quality, readability, and maintainability without altering its output behavior.
Predict the Output of a Simple Number Check Function
Analyze a Python function that checks if a number is positive, negative, or zero, and predict its output for given inputs.
Refactor a Function to Cleanly Aggregate User Purchases
The provided JavaScript function processes an array of user purchase objects to calculate total spending per user. The existing code works but is messy and repetitive. Refactor it for clarity, reusability, and improved readability without changing its behavior.
Refactor and Optimize Complex Sales Reporting SQL Query
Optimize a poorly written, inefficient SQL query that aggregates sales data by region and product category while filtering on multiple conditions. Improve readability, performance and ensure the output remains correct.
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.
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.
Build a Personal Expense Tracker Mini Project
Create a Python program that allows users to add, view, and analyze their personal expenses over time, helping them track spending habits.
Create a Function to Calculate the Square of a Number
Write a Python function that takes a single number as input and returns its square. This is a fundamental exercise to practice defining functions and using arithmetic operators.
Fix a Bug in an SQL Query for Aggregated Sales Performance with Window Functions
Identify and fix the bug in a complex SQL query that attempts to calculate monthly sales performance rankings by salesperson, using window functions and joins.
Refactor SQL Query to Optimize Simple SELECT with CASE
Improve the readability and efficiency of a beginner-level SQL query that uses multiple CASE statements to classify product sales data without changing its behavior.
Fix the SQL Query to Retrieve Employees with Salary Over 50000
In this challenge, you are given a broken SQL query intended to select all employees earning more than 50000. Your task is to identify and fix the bugs so that the query returns the correct results.
Refactor a Function to Compute Unique Elements Frequency
Improve the provided Python function that calculates the frequency of unique elements in a list. Refactor the code for better readability, efficiency, and Pythonic style without changing its behavior.
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.
Design and Optimize a Sales Database Schema with Advanced Queries
Create a normalized database schema for a retail sales system that handles customers, products, orders, and shipments. Then, write optimized SQL queries to retrieve key business insights including sales trends, customer segmentation, and shipment statuses.
Refactor a Function to Calculate Average Scores with Better Readability and Efficiency
Improve a messy JavaScript function that calculates average scores from an array of student objects, making the code cleaner, more efficient, and easier to understand without changing its behavior.
Design and Query a Multi-Level Employee Management Hierarchy
Create a relational data model to represent an organization's employee hierarchy with multiple reporting levels and implement complex SQL queries to retrieve hierarchical reports and aggregate statistics.
Design and Query an Employee Hierarchy Data Model
Create a normalized data model to represent an employee hierarchy within a company, then write an advanced SQL query to retrieve hierarchical reports and aggregated information.
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 Complex Nested Callbacks into Clean Async/Await Flow
Refactor a nested callback-based event processing function into clean, modular, and maintainable async/await style JavaScript code without changing the behavior or output.
Create a SQL Function to Calculate Customer Lifetime Value (CLV)
Write a SQL function that calculates the Customer Lifetime Value (CLV) based on customer transactions, applying discounting over time and accounting for customer churn rate.
Fix the Bug in Array Filtering and Object Mapping Function
Identify and fix the bug in a JavaScript function designed to filter an array of user objects and map them to a list of their names based on age criteria.
Build a Task Manager CLI Application in Python
Create a command-line task manager in Python that allows users to add, complete, delete, and list tasks with due dates and priorities.
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.
Create a Deep Object Merge Function
Build a JavaScript function that takes two objects and merges them deeply, combining nested objects instead of overwriting them.
Refactor SQL Query for Optimized Employee Sales Report
Improve the given SQL query for generating a monthly sales report by employee to increase readability and performance without changing the output.
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.
Fix the Recursive Sales Totals Query for Hierarchical Employees
You are given a broken SQL query intended to calculate total sales made by each employee and their subordinates in a hierarchical company structure. The query uses a recursive CTE but produces incorrect or incomplete totals. Your task is to identify and fix the bugs so that the query accurately computes cumulative sales totals including all levels of subordinates.
Create a Function to Convert Celsius to Fahrenheit
Write a JavaScript function that converts a temperature from Celsius to Fahrenheit.
Design and Query an Employee-Project Assignment Schema
Create a normalized database schema to manage employees, projects, and their assignments. Write SQL queries to retrieve project involvement and employee workloads.
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.
Predict the Output of a Basic For Loop with Condition
Analyze the given JavaScript code snippet involving a for loop and conditional statements, then determine the output printed to the console.
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.
Refactor Messy Code to Calculate the Sum of Even Numbers
Improve the readability and quality of a Python function that calculates the sum of even numbers from a list, while keeping the output correct.
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.
Create a Simple Employee and Department Tables with Basic Queries
Build and query basic employee and department tables to practice simple SQL data modeling and retrieval.