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

Refactor Messy Inventory Management Code

Improve the structure and readability of a cluttered C++ function that manages inventory updates while preserving its original behavior.

Start Today’s Duel
intermediate10 minutes

Browse by language

Choose a language and jump into practical challenges.

Featured Duels

Start with strong practice problems across languages.

beginner5 minutes

Sum Two Values

Write a function that returns the sum of two numbers.

functionsparametersreturn values
beginner7 minutes

Count Even Numbers

Count how many even numbers appear in a list.

loopsconditionalslists
intermediate10 minutes

Find the Second Highest Salary

Return the second highest salary from an employees table.

subqueriessortingdistinct
intermediate12 minutes

Reverse a String Without Built-Ins

Reverse a string manually without using built-in reverse helpers.

stringsloopsindexing
beginner10 minutes

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.

GROUP BYSUM()ORDER BY
beginner10 minutes

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.

string manipulationfunctionsarrays
beginner10 minutes

Sum All Odd Numbers in a List

Write a function that calculates the sum of all odd numbers in a given list of integers.

loopsconditional statementsfunctions
beginner10 minutes

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.

SQL AggregationGROUP BY clauseBasic SQL functions
beginner10 minutes

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.

arraysobjectsfunctions
beginner10 minutes

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.

Basic SQL syntaxSELECT statementColumn and table naming
advanced15 minutes

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.

Window FunctionsMedian CalculationAggregate Functions
intermediate15 minutes

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.

SQL JOINsmany-to-many relationshipsforeign keys
advanced10 minutes

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.

recursionbitwise operationsstatic variables
advanced15 minutes

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).

decoratorscachingfunction arguments
intermediate15 minutes

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.

closuresarraysobjects
advanced15 minutes

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.

asynchronous programmingerror handlingpromises
beginner10 minutes

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.

variables initializationfor loopbasic arithmetic operations
advanced15 minutes

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.

closuresasynchronous timingfunction properties
intermediate10 minutes

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.

SQL joinsaggregate functionsquery optimization
intermediate30 minutes

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.

collaborative filteringmatrix operationssimilarity metrics
beginner10 minutes

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.

structsvectorsloops
advanced15 minutes

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.

Code RefactoringC++ Best PracticesObject-Oriented Programming
beginner10 minutes

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.

ArraysFunctionsArray methods
intermediate10 minutes

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.

Correlated subqueriesJOIN operationsAggregation functions
advanced40 minutes

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.

SQL schema designData normalizationRelational modeling
intermediate10 minutes

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.

window functionsrunning totalSQL function
advanced15 minutes

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.

code refactoringperformance optimizationcode readability
beginner10 minutes

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.

functionsreturn statement
intermediate10 minutes

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.

JavaScript destructuringdefault values in destructuringarrays and objects
beginner10 minutes

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.

arithmetic operationsoperator precedencedata types and integer division
advanced15 minutes

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.

SQL aggregationGROUP BY clauseJOIN operations
intermediate10 minutes

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.

recursionlist manipulation
advanced15 minutes

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.

recursionstring parsingdata serialization
intermediate10 minutes

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.

code refactoringlist comprehensionsconditional filtering
beginner10 minutes

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.

conditionalsfunctions
intermediate10 minutes

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.

JavaScript arraysObject manipulationArray reduce method
advanced15 minutes

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.

SQL optimizationJoins and subqueriesAggregation and grouping
intermediate20 minutes

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.

classes and objectsstd::vectorloops and conditionals
advanced15 minutes

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.

recursionmemoizationdynamic programming
beginner10 minutes

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.

variablesconditional statementsinput/output
intermediate15 minutes

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.

lists and dictionariesloop and conditionalsdata aggregation
beginner10 minutes

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.

functionsarithmetic operatorsreturn statement
advanced15 minutes

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.

window functionsSQL aggregationjoins
beginner10 minutes

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.

CASE statementsSQL query refactoringquery readability
beginner10 minutes

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.

SQL SELECT statementWHERE clauseComparison operators
intermediate10 minutes

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.

dictionarycollections.Countercode refactoring
intermediate10 minutes

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.

nested loopsconditional statementsvariable manipulation
intermediate10 minutes

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.

Classes and StructsVectorsBasic Algorithms (averaging, max finding)
advanced60 minutes

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.

Normalized schema designRelational database modelingSQL aggregation and window functions
intermediate10 minutes

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.

code refactoringarray methodscode readability
advanced45 minutes

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.

recursive Common Table Expressionsself-referencing foreign keyshierarchical data modeling
advanced30 minutes

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.

recursive CTEself-referencing foreign keydata normalization
advanced20 minutes

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.

Modern C++Smart pointersSTL algorithms
advanced15 minutes

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.

async/awaitcallbackspromises
advanced15 minutes

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.

window functionsdate/time calculationdiscounted cash flow
intermediate10 minutes

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.

array filteringarray mappingcallback functions
intermediate15 minutes

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.

datetime handlinglist sortingdictionary usage
beginner10 minutes

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.

variablesloopsconditionals
intermediate15 minutes

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.

recursionobject manipulationimmutability
intermediate10 minutes

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.

SQL joinsAggregate functionsQuery optimization
advanced10 minutes

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.

pointer arithmeticreference to pointerpre-increment vs post-increment
advanced15 minutes

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.

recursive CTEhierarchical queriesaggregation
beginner10 minutes

Create a Function to Convert Celsius to Fahrenheit

Write a JavaScript function that converts a temperature from Celsius to Fahrenheit.

functionsarithmetic operatorsreturn statement
intermediate15 minutes

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.

database normalizationjoins (LEFT JOIN)aggregate functions (SUM, COUNT)
advanced20 minutes

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.

inheritancepolymorphismcode refactoring
beginner10 minutes

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.

for loopconditionalsstring concatenation
advanced15 minutes

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.

Memory managementPointers and dynamic allocationLinked list traversal
beginner10 minutes

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.

loopsconditionalsfunctions
intermediate10 minutes

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.

map usageloopsconditional logic
beginner10 minutes

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.

CREATE TABLEINSERT INTOINNER JOIN
advanced60 minutes

Advanced Social Network Graph Analyzer in Python

Build a Python mini-project that processes and analyzes a social network graph to extract insights such as influential users, community detection, and shortest connection paths.

Graph Data StructuresGraph AlgorithmsCommunity Detection
advanced10 minutes

Predict the Output of a Recursive Memoization with Mutable Default Argument

Analyze a Python function that uses recursion combined with mutable default arguments and memoization, then predict the exact printed output when the function is called.

RecursionMemoizationMutable Default Arguments
intermediate10 minutes

Refactor Messy C++ Code for Calculating Statistics on an Integer Array

Improve and clean up a provided C++ function that calculates the minimum, maximum, and average of an integer array while maintaining the same behavior.

Code RefactoringLoopsVariable Naming
beginner10 minutes

Create a Function to Get Employee Names by Department

Write a SQL function that returns a list of employee names for a given department from an employees table.

basic SQL SELECTfunctionsWHERE clause
intermediate10 minutes

Build a Python Expense Tracker with Categorization and Summaries

Create a Python mini-project to manage daily expenses, categorize them, and generate summary reports for monthly spending by category.

listsdictionariesdatetime handling
advanced15 minutes

Build a High-Performance Memoized Fibonacci Function Using C++ Templates

Create an advanced C++ function that computes Fibonacci numbers efficiently using both memoization and template metaprogramming techniques to optimize compile-time and run-time performance.

memoizationtemplate metaprogrammingconstexpr functions
intermediate10 minutes

Fix the Incorrect JOIN Condition in Employee Salary Query

Identify and fix the bug in the provided SQL query that calculates the total salary by department. The current query returns incorrect totals due to a faulty JOIN condition.

SQL JOINsAggregation (SUM, GROUP BY)Debugging SQL queries
intermediate10 minutes

Refactor Nested Loops to Improve Code Readability and Efficiency

Refactor the given Python function that uses nested loops to find common elements between two lists. Improve its readability and performance without changing its behavior.

refactoringperformance optimizationdata structures (sets and lists)
beginner10 minutes

Refactor to Optimize a Basic Employee Salary Query

Improve the given SQL query that retrieves employee names and salaries, by refactoring it to be more efficient while keeping the result unchanged.

SELECTWHERE clausesubqueries
beginner10 minutes

Fix the Off-By-One Error in Loop Summation

Debug a simple function in C++ that aims to sum integers from 1 to n but produces incorrect results due to an off-by-one error in the loop.

loopsfor loopoff-by-one error
advanced10 minutes

Predict the Output of Recursive Nested Dictionary Merge with Side Effects

Analyze the given Python function that performs a recursive merge of nested dictionaries with side effects on mutable inputs. Predict the exact output of the code including the final printed dictionaries.

recursiondictionary mutationnested data structures
intermediate10 minutes

Predict the Output: Array Transformation and Loop Logic in C++

Analyze the given C++ code snippet that performs multiple array transformations and loop operations. Predict the final output printed by the program without running it.

array manipulationfor loopsin-place modification
advanced15 minutes

Refactor a Complex C++ Class for Cleaner Design and Performance

Refactor the given C++ class that manages a large dataset with inefficient and messy logic. Improve code readability, maintainability, and performance while preserving functionality.

code-refactoringconst-correctnessdata-encapsulation
beginner10 minutes

Build a Simple Grocery List Manager

Create a Python program that allows users to add items to a grocery list, remove items, and display the current list. This mini-project helps beginners practice working with lists, loops, and functions.

listsloopsuser input
advanced90 minutes

Advanced File System Explorer and Analyzer

Build a C++ program that recursively explores a given directory, constructs an in-memory model of the entire file system hierarchy starting at that directory, and generates detailed reports including total file counts, directory sizes, and file type distributions. The project tests your skills in recursion, data structures, file I/O, and performance optimization.

recursionfilesystemdata structures
intermediate10 minutes

Build a Function to Merge and Sort Unique Elements from Two Lists

Create a Python function that takes two lists of integers and returns a sorted list containing all unique elements from both lists.

list manipulationsetssorting
intermediate10 minutes

Fix the Bug in Filtering and Summing Product Prices

The provided JavaScript function is intended to filter products by category and then calculate the total price of those filtered products. However, it contains bugs that prevent it from working correctly. Your task is to debug and fix the function so that it returns the correct total price for the specified category.

Array.prototype.filterArray.prototype.reduceArrow functions
advanced45 minutes

Advanced Event Scheduler with Conflict Resolution in C++

Build an advanced event scheduler that manages multiple events with time conflicts resolution. The scheduler must support adding, removing, updating events, and querying free time slots efficiently.

interval treesconflict resolutiondata structures
beginner10 minutes

Refactor SQL Query for Retrieving Active Users

Optimize and refactor a simple SQL query to improve readability and performance while maintaining the same output.

SQL SELECTWHERE clause filteringQuery simplification
beginner10 minutes

Refactor a SQL Query to Improve Readability and Efficiency

You are given a simple SQL query written with redundant expressions and unnecessary complexity. Refactor the query to improve its readability and optimize performance while keeping the same output.

SQL SELECT statementWHERE clause optimizationColumn aliasing
advanced60 minutes

Advanced Text Summarizer Using TF-IDF and Cosine Similarity

Build a Python function that performs extractive text summarization by selecting the most important sentences based on TF-IDF vectors and sentence similarity measures.

Text preprocessingTF-IDF vectorizationCosine similarity
intermediate10 minutes

Refactor a Function for Summarizing Employee Sales Data

Improve the readability and efficiency of a given Python function that processes a list of employee sales records and returns a summary dictionary.

refactoringdictionary operationsloops
intermediate15 minutes

Build a Task Progress Tracker with Status Summary

Create a Python function to track the progress of multiple tasks with varying statuses and provide a summary of counts per status.

dictionarieslist iterationgrouping data
advanced15 minutes

Fix the Bug in SQL Query Calculating Running Totals with Incorrect Window Frames

Identify and fix the logical error in the given SQL query that attempts to calculate running totals of sales per customer, but returns incorrect results due to improper window frame specification.

window functionswindow framesSQL debugging
advanced20 minutes

Fix Memory Leak and Logic Errors in a Multi-threaded Task Scheduler

You are given a flawed C++ implementation of a simple multi-threaded task scheduler that manages and executes tasks concurrently. The code contains memory leaks, race conditions, and logic errors that cause incorrect task execution and resource cleanup issues. Your job is to identify and fix the bugs to produce a robust, leak-free, and correctly functioning scheduler.

memory managementmultithreadingresource cleanup
advanced60 minutes

Build a Dynamic Kanban Board with Drag-and-Drop in JavaScript

Create a fully functional Kanban board application that supports adding, moving, and editing tasks across multiple columns using native JavaScript and the Drag-and-Drop API.

Drag and Drop APIlocalStorage persistenceDOM manipulation
beginner10 minutes

Refactor a Simple Temperature Converter Function

Improve the readability and efficiency of a basic Python function that converts temperatures from Celsius to Fahrenheit.

function refactoringbasic arithmetic operationsreturn statements
intermediate10 minutes

Fix the Bug in Filtering Unique Usernames from an Array

The provided JavaScript function is supposed to return an array of unique usernames from a list of user objects. However, it currently returns duplicates. Your task is to debug and fix the code to ensure it returns only unique usernames.

arraysloopsconditionals
beginner10 minutes

Create a Basic Employee Directory Table and Query

Build a simple employee directory table and write a query to retrieve filtered information about employees, practicing basic SQL data modeling and SELECT queries.

CREATE TABLEINSERT INTOSELECT
intermediate10 minutes

Fix the Off-By-One Error in List Processing Function

Identify and fix the bug in a Python function designed to process a list of numbers and return a transformed list. The current implementation has an off-by-one error causing incorrect output.

list indexingloopsoff-by-one error
advanced15 minutes

Fix the Bug in the Multithreaded Singleton Logger Implementation

Identify and fix the concurrency bug in a classic thread-safe Singleton Logger class in C++. The provided code attempts lazy initialization with double-checked locking but contains subtle issues that may cause race conditions or undefined behavior in a multithreaded environment.

thread safetysingleton patterndouble-checked locking
advanced90 minutes

Build a Scalable URL Shortener Service in Python

Create a mini-project to develop a URL shortener service that generates unique short URLs, supports custom aliases, and includes analytics features such as click tracking and expiration dates.

Hashing and encoding techniquesData structures and mappingsState management and persistence
beginner10 minutes

Refactor a Repetitive SQL Query Using Aliases and Simplified WHERE Clause

Optimize a beginner-level SQL query by refactoring repetitive conditions and using table aliases for clarity. The query fetches all employees from the 'employees' table who belong to certain departments and have a salary above a threshold.

SQL SELECT statementWHERE clause conditionsTable aliases
intermediate10 minutes

Refactor Messy JavaScript Array Processing Function

Clean up and improve the readability and efficiency of a JavaScript function that processes an array of user objects. The function currently contains redundant code, unclear variable names, and inefficient looping that you need to refactor without changing its output.

array methodscode refactoringvariable naming
intermediate15 minutes

Build a SQL Function to Find Top Customers by Total Spend

Create a SQL scalar function that calculates the top N customers based on their total purchase amount from sales data.

JOINGROUP BYAGGREGATION
intermediate10 minutes

Create a Function to Merge Two Sorted Arrays Without Duplicates

Build a C++ function that takes two sorted integer arrays and returns a new sorted array containing all unique elements from both arrays, effectively merging them without duplicates.

vectorstwo-pointer techniquearrays
beginner10 minutes

Create a Function to Calculate Average Salary by Department

Write an SQL function that calculates the average salary for a given department from an employee table.

CREATE FUNCTIONAVG aggregate functionWHERE clause
beginner10 minutes

Refactor a Function to Calculate Factorial More Cleanly

Improve the clarity and simplicity of a provided factorial function without changing its behavior. Practice writing clean and readable Python code.

functionsloopsvariables
intermediate10 minutes

Build a Weather Dashboard with Dynamic City Search

Create a small weather dashboard application in JavaScript that fetches and displays weather data for cities searched by the user, using a public weather API.

API consumptionasynchronous JavaScripterror handling
intermediate10 minutes

Refactor a SQL Query for Efficient Employee Sales Aggregation

Improve a provided SQL query that calculates total sales per employee by refactoring it for better readability and optimization, while preserving its original behavior and output.

SQL JOINAggregationSubquery refactoring
advanced15 minutes

Build a Memoized Recursive Fibonacci Function with Performance Tracking

Create a Python function to compute Fibonacci numbers using memoization to optimize recursive calls. Additionally, implement performance tracking to count how many times the function is called and how many cache hits occur.

recursionmemoizationfunction attributes
intermediate10 minutes

Fix Bug in C++ Function to Find Maximum Product of Two Elements

The provided C++ function is intended to find the maximum product of any two distinct elements in an integer array. However, it contains logical and implementation bugs that lead to incorrect results or runtime errors. Your task is to identify and fix these bugs to ensure the function works correctly for all valid inputs.

nested loopsarray indexingedge case handling
beginner10 minutes

Fix the Bug in the Function That Calculates the Sum of an Array

This challenge involves debugging a simple JavaScript function that is intended to sum all numbers in an array but currently returns an incorrect result.

loopsvariablesarrays
advanced30 minutes

Build a Function to Perform Symbolic Differentiation of Polynomials in C++

Create an advanced C++ function that takes a polynomial expression as a string input and returns its derivative as another string. This function should handle multiple terms, coefficients, exponents, and the variable x correctly, performing symbolic differentiation in standard mathematical notation.

string parsingsymbolic computationpolynomial differentiation
advanced15 minutes

Fix Memory Leak and Concurrency Bug in Thread-Safe Cache Implementation

Given an incomplete and buggy thread-safe LRU cache implementation in C++, identify and fix issues related to memory leaks, data races, and incorrect cache eviction logic.

concurrencymemory managementLRU cache
beginner10 minutes

Build a Simple Employees and Departments Table with Basic Queries

Create two related tables, Employees and Departments, and write SQL queries to retrieve basic information such as employee names, their departments, and departments with employee counts.

SQL CREATE TABLEFOREIGN KEY constraintJOIN
intermediate15 minutes

Create a Function to Find the Longest Palindromic Substring

Write a Python function that takes a string as input and returns the longest palindromic substring within it. A palindrome reads the same backward as forward. This intermediate challenge helps you practice string manipulation and algorithmic thinking.

String manipulationTwo pointer techniquePalindrome detection
advanced30 minutes

Design and Query a Normalized E-Commerce Sales Data Model

Create a relational schema to model an e-commerce sales environment and write advanced SQL queries to retrieve complex insights on sales performance and customer behavior.

normalized database designforeign key constraintsadvanced SQL aggregation
advanced60 minutes

Advanced Task Scheduler: Build a Priority-based Task Manager in Python

Create a Python mini-project that manages a list of tasks with start times, durations, and priorities, optimizing scheduling to avoid conflicts based on priority and timing.

datetime manipulationtask schedulingpriority queue
advanced15 minutes

Refactor and Optimize Deeply Nested Array and Object Processing in JavaScript

Improve the readability, maintainability, and performance of a complex function that processes deeply nested arrays and objects without changing its behavior.

code refactoringarray iteration and transformationnested object handling
advanced10 minutes

Build a Memoized Recursive Function to Calculate Large Fibonacci Numbers

Implement an efficient recursive function in C++ that computes the nth Fibonacci number leveraging memoization to optimize overlapping subproblems, capable of handling large input values.

recursionmemoizationdynamic programming
intermediate10 minutes

Refactor Nested Loops and Conditionals into Clean Functional Code

Improve the readability and maintainability of a JavaScript function that calculates a summary from an array of user objects with nested loops and conditionals, by refactoring it using higher-order array methods and cleaner logic without changing its behavior.

Array methodsFunctional programmingCode readability
advanced15 minutes

Fix Bug in Advanced Multithreaded Bank Account Simulation

You are given a broken multithreaded C++ program simulating deposits and withdrawals on a bank account. The code uses mutexes to protect the balance but still produces inconsistent results due to subtle bugs. Your task is to identify and fix these concurrency and logic bugs to ensure the balance always stays correct after concurrent operations.

multithreadingmutexrace condition
beginner10 minutes

Build a Simple Bank Account Manager in C++

Create a basic console application in C++ to simulate a simple bank account manager that allows a user to deposit, withdraw, and check their balance.

Classes and ObjectsConditional statementsLoops
intermediate10 minutes

Predict the Output of a Complex SQL JOIN with Aggregation and Filtering

Analyze the given SQL query that involves multiple JOINs, aggregation, and HAVING clauses, and predict the final output.

JOIN operationsGROUP BY aggregationHAVING clause filtering
advanced10 minutes

Predict the Output of a Complex Recursive Lambda with State Captures in C++

Understand and predict the output of advanced C++ code involving recursive lambdas with mutable and reference state captures that manipulate shared variables and invoke themselves conditionally.

recursive lambda functionsmutable lambda capturesreference captures
intermediate10 minutes

Fix the Incorrect JOIN Conditions in SQL Sales Report Query

This challenge presents a SQL query intended to generate a monthly sales summary by joining the sales and products tables. However, the query contains incorrect join logic that leads to incorrect results or excessive rows. Your task is to fix the join conditions and any other issues to produce an accurate sales report.

SQL JOIN conditionsSQL AggregationDate Filtering in SQL
advanced20 minutes

Build a Memoized Async Function Runner with Concurrency Control

Create an advanced utility function in JavaScript that memoizes asynchronous functions and limits their concurrency, optimizing performance and resource usage.

asynchronous programmingmemoizationconcurrency control
advanced15 minutes

Refactor Legacy C++ Code to Enhance Readability and Performance

Given a legacy C++ function that processes and filters a vector of user data with multiple nested loops and repeated conditions, refactor the code to improve readability, reduce complexity, and optimize performance while preserving the original behavior.

C++ STL algorithmscode refactoringperformance optimization
advanced120 minutes

Advanced File System Indexer and Search Tool in C++

Build a highly efficient file system indexer that recursively scans directories, indexes file metadata, and supports advanced search queries with filters and sorting, all implemented in C++.

filesystem traversaldata structures and algorithmsfile metadata handling
advanced15 minutes

Fix Bug in Advanced Recursive Directory Size Calculator

Debug and correct a broken Python function designed to recursively compute total file sizes in nested directory structures represented as dictionaries.

recursiontype checkingdictionary traversal
beginner10 minutes

Refactor a SQL Query to Simplify and Optimize Filtering

Improve a given SQL query by refactoring it for clarity and better performance while maintaining the same output. This challenge focuses on rewriting a query that uses unnecessary subqueries and redundant filtering.

WHERE clause simplificationSubquery refactoringBasic SQL filtering
advanced40 minutes

Build a Scalable Task Scheduler with Dependency Resolution in Python

Create a mini-project in Python to implement a task scheduler that executes tasks in the correct order based on their dependencies. The scheduler should detect circular dependencies and optimize for concurrent execution where possible.

topological sortgraph algorithmscycle detection
intermediate10 minutes

Predict the Output of a List Comprehension with Nested Conditions

Analyze a Python code snippet using nested list comprehensions with conditional statements and predict the final output list.

list comprehensionnested loopsconditional filtering
advanced15 minutes

Fix Bug in SQL Query for Customer Lifetime Value Calculation

Identify and fix the bug in the provided SQL query that attempts to calculate the Customer Lifetime Value (CLV) by aggregating total purchases over all transactions per customer, but currently returns incorrect results due to improper GROUP BY and JOIN logic.

SQL AggregationJOINsGROUP BY
advanced10 minutes

Advanced SQL Output Prediction: Recursive CTE with Window Functions

Analyze the given SQL query utilizing recursive Common Table Expressions (CTEs) combined with window functions, and predict the exact output it will generate based on the provided data.

Recursive CTEWindow FunctionsHierarchical Queries
beginner10 minutes

Create a Simple Employee-Department Relationship Table

Build SQL tables to model employees and departments, then write queries to retrieve employee details along with their department names.

CREATE TABLEPRIMARY KEYFOREIGN KEY
advanced15 minutes

Build a Memoized Recursive Function to Calculate the nth Generalized Fibonacci Number

Create a function that efficiently computes the nth term of a generalized Fibonacci sequence, where the first k terms are given and each subsequent term is the sum of the previous k terms. Implement memoization to optimize the recursive calculations.

recursionmemoizationdynamic programming
advanced60 minutes

Design and Implement a Thread-Safe LRU Cache in C++

Create a high-performance, thread-safe Least Recently Used (LRU) cache class in C++. The cache should support concurrent access from multiple threads and provide O(1) time complexity for insertions, lookups, and deletions.

Concurrency and thread safetyData structures (unordered_map and linked list)Cache eviction policies (LRU)
intermediate10 minutes

Refactor a Slow Sales Summary Query for Better Performance

Improve the efficiency of a SQL query that summarizes total sales by product category and month by simplifying its logic and optimizing joins and aggregations.

SQL query optimizationjoins and aggregationsGROUP BY
advanced15 minutes

Fix the Memory Leak and Logical Bugs in Async Data Processor

Identify and correct bugs in an asynchronous JavaScript function that processes a large dataset with complex filtering and transformations. The current implementation suffers from logical errors and potential memory leaks causing performance degradation.

async/awaitarray methodsmemory management
beginner10 minutes

Simple Temperature Converter Mini Project

Build a small program that converts temperatures between Celsius and Fahrenheit scales, allowing users to enter a temperature and choose the conversion direction.

functionsconditionalsuser input/output
advanced15 minutes

Refactor and Optimize a Multithreaded Logging System in C++

Improve the readability, maintainability, and performance of an existing multithreaded logging system while preserving its functionality.

multithreadingmutex and lockingcondition variables
intermediate10 minutes

Build a Function to Flatten Nested Lists by One Level

Create a Python function that takes a list containing nested sublists and returns a new list flattened by exactly one level. This means only the first level of nested lists should be expanded, while deeper nested structures remain intact.

list manipulationtype checkingiteration
advanced15 minutes

Refactor and Optimize a Complex SQL Query Using Window Functions

Given a complex SQL query with multiple nested subqueries and joins, refactor it to improve readability, performance, and maintainability while preserving the original output.

Window FunctionsCommon Table Expressions (CTEs)Query Optimization
advanced15 minutes

Build a Memoized Deep Clone Function with Circular Reference Handling

Create an advanced JavaScript function that performs a deep clone of any given object, including nested objects and arrays, while efficiently handling circular references using memoization to avoid infinite loops.

deep cloningcircular referencesmemoization
intermediate10 minutes

Fix the Bug in SQL Query to Correctly Calculate Employee Department Averages

You are given a SQL query that attempts to calculate the average salary per department along with the department name. However, the query is not returning correct results due to a bug in the JOIN and GROUP BY clauses. Your task is to identify and fix the bug to ensure the query returns each department's name along with the average salary of its employees.

JOIN operationsGROUP BY clauseAggregate functions
advanced90 minutes

Advanced File System Simulation with C++

Create an advanced mini-project that simulates a hierarchical file system including files and folders with operations like add, delete, move, and search, using efficient data structures in C++.

Object-Oriented ProgrammingData Structures (Trees)Recursion