Code Challenges

Apply your knowledge with hands-on coding exercises.

Implement Bubble Sort in JavaScript
Click to view details and solution.
Implement Binary Search on a sorted array
Click to view details and solution.
Reverse a singly Linked List
Click to view details and solution.
Detect if a Linked List has a cycle (Floyd's Cycle-Finding Algorithm)
Click to view details and solution.
Check if a string of parentheses '()[]{}' is valid
Click to view details and solution.
Merge two sorted linked lists into one sorted list
Click to view details and solution.
Find the contiguous subarray with the largest sum (Kadane's Algorithm)
Click to view details and solution.
Given an array of integers and a target, return indices of the two numbers that add up to target
Click to view details and solution.
Find the Lowest Common Ancestor (LCA) in a Binary Search Tree (BST)
Click to view details and solution.
You are climbing a staircase
Click to view details and solution.
Invert a binary tree
Click to view details and solution.
Find the maximum depth of a binary tree
Click to view details and solution.
Check if two binary trees are the same
Click to view details and solution.
Given a grid of '1's (land) and '0's (water), count the number of islands
Click to view details and solution.
Find length of longest substring without repeating characters
Click to view details and solution.
Find all unique triplets in the array which gives the sum of zero
Click to view details and solution.
Find two lines that together with the x-axis form a container, such that the container contains the most water
Click to view details and solution.
Group an array of strings into anagrams
Click to view details and solution.
Sort an array of 0s, 1s, and 2s in-place (Dutch National Flag problem)
Click to view details and solution.
Return an array such that answer[i] is equal to the product of all the elements of nums except nums[i]
Click to view details and solution.
Implement a function to flatten a nested array
Click to view details and solution.
Write a function to find the first non-repeated character in a string
Click to view details and solution.
Implement a debounce function
Click to view details and solution.
Implement a throttle function
Click to view details and solution.
Write a function to reverse a string
Click to view details and solution.
Implement a deep clone function for a JavaScript object
Click to view details and solution.
Write a function to check if a string is a palindrome
Click to view details and solution.
Implement a function to sort an array of objects by a specific key
Click to view details and solution.
Write a function to find the intersection of two arrays
Click to view details and solution.
Implement a simple memoization decorator
Click to view details and solution.
Write a function to check if an object has a circular reference
Click to view details and solution.
Implement a function to create a promise that resolves after a given delay
Click to view details and solution.
Given an array of numbers, find the sum of all even numbers
Click to view details and solution.
Implement Promise
Click to view details and solution.
Write a function that takes an array of strings and groups them by their first letter
Click to view details and solution.
Create a function that fetches data from multiple URLs concurrently and returns the results when all have completed
Click to view details and solution.
Implement a function to validate an email address using a regular expression
Click to view details and solution.
Write a function to calculate the factorial of a number (recursive and iterative)
Click to view details and solution.
Implement a basic data structure like a Queue or Stack
Click to view details and solution.
Given a binary tree, implement a function to perform a Breadth-First Search (BFS) or Depth-First Search (DFS)
Click to view details and solution.
Create a simple counter component with increment and decrement buttons
Click to view details and solution.
Build a form component that handles input changes and submission
Click to view details and solution.
Implement a component that fetches data from an API and displays it
Click to view details and solution.
Create a reusable button component with different variants (primary, secondary)
Click to view details and solution.
Build a modal component that can be toggled open and closed
Click to view details and solution.
Implement a list component that renders a dynamic list of items, with functionality to add/remove items
Click to view details and solution.
Create a toggle switch component
Click to view details and solution.
Build a pagination component for a list of items
Click to view details and solution.
Implement a search filter for a list of items
Click to view details and solution.
Create a simple quiz application with multiple questions and scoring
Click to view details and solution.
Build a form with validation using useState and basic JavaScript
Click to view details and solution.
Implement a component that listens to window resize events and updates its state
Click to view details and solution.
Create a component that uses useContext to share data between components without prop drilling
Click to view details and solution.
Build a component that fetches data and caches it using useMemo or a custom hook
Click to view details and solution.
Implement a component that uses React
Click to view details and solution.
Create a custom hook for fetching data from an API
Click to view details and solution.
Build a dropdown component with keyboard navigation
Click to view details and solution.
Implement a drag-and-drop functionality for list items
Click to view details and solution.
Create a component that displays a progress bar based on some value
Click to view details and solution.
Build a simple chat interface where messages appear in real-time (simulate with setInterval)
Click to view details and solution.
Create a custom hook useWindowSize that returns the window dimensions
Click to view details and solution.
Implement a Higher Order Component (HOC) withLoading that displays a loading spinner
Click to view details and solution.
Create a StarRating component that allows users to select a rating
Click to view details and solution.
Build a Stopwatch component with Start, Stop, and Reset functionality
Click to view details and solution.
Implement a Tabs component that switches content based on the active tab
Click to view details and solution.
Build an ErrorBoundary component
Click to view details and solution.
Implement a useLocalStorage custom hook
Click to view details and solution.
Create an Autocomplete/Typeahead component
Click to view details and solution.
Implement a Todo list with useReducer
Click to view details and solution.
Build a simple ThemeProvider component
Click to view details and solution.
Create a simple counter component in Vue with increment and decrement buttons
Click to view details and solution.
Build a form component in Vue that handles input changes and submission
Click to view details and solution.
Implement a component that fetches data from an API and displays it
Click to view details and solution.
Create a reusable button component in Vue with different variants (primary, secondary)
Click to view details and solution.
Build a modal component in Vue that can be toggled open and closed
Click to view details and solution.
Implement a list component in Vue that renders a dynamic list of items, with functionality to add/remove items
Click to view details and solution.
Create a toggle switch component
Click to view details and solution.
Build a pagination component in Vue for a list of items
Click to view details and solution.
Implement a search filter in Vue for a list of items
Click to view details and solution.
Create a simple quiz application in Vue with multiple questions and scoring
Click to view details and solution.
Build a form with validation using Vue's built-in validation or custom logic
Click to view details and solution.
Implement a component that listens to window resize events and updates its data
Click to view details and solution.
Create a component that uses provide/inject to share data between components without prop drilling
Click to view details and solution.
Build a component that fetches data and caches it using a computed property or watcher
Click to view details and solution.
Implement a component that uses v-once or a memoization technique to optimize rendering for a static list item
Click to view details and solution.
Create a custom directive (e
Click to view details and solution.
Build a dropdown component with keyboard navigation
Click to view details and solution.
Implement a drag-and-drop functionality for list items
Click to view details and solution.
Create a component that displays a progress bar based on some value
Click to view details and solution.
Build a simple chat interface where messages appear in real-time (simulate with setInterval)
Click to view details and solution.
Build a mouse tracker composable (useMouse) that tracks x/y coordinates
Click to view details and solution.
Create a custom directive v-focus that focuses the input on mount
Click to view details and solution.
Implement Infinite Scroll using IntersectionObserver in Vue
Click to view details and solution.
Build a Tree View component that recursively renders itself
Click to view details and solution.
Setup a simple Pinia store for counter and use it in a component
Click to view details and solution.
Create a Modal using Vue Teleport so it renders inside body
Click to view details and solution.
Build a Renderless Component that handles toggle logic using scoped slots
Click to view details and solution.
Implement a Dynamic Form Builder based on a JSON schema
Click to view details and solution.
Create a Skeleton Loader component
Click to view details and solution.
Implement Image Lazy Loader using IntersectionObserver in a directive
Click to view details and solution.
Build a 'Click Outside' directive to close a dropdown
Click to view details and solution.
Create a simple virtual scroller (renders only visible items)
Click to view details and solution.
Implement a reusable Notification Toast component
Click to view details and solution.
Build a generic Data Table component with sorting
Click to view details and solution.
Build a simple chatbot using OpenAI API that maintains conversation history
Click to view details and solution.
Implement a semantic search system using embeddings
Click to view details and solution.
Build a basic RAG (Retrieval-Augmented Generation) system that retrieves relevant documents and generates answers
Click to view details and solution.
Implement streaming responses from an LLM API to display tokens as they're generated
Click to view details and solution.
Implement function calling (tools) with an LLM to fetch real-time data
Click to view details and solution.
Build a text classifier that categorizes customer feedback into categories (positive, negative, neutral, bug report, feature request)
Click to view details and solution.
Integrate DALL-E image generation into an application
Click to view details and solution.
Build a simple AI agent that can use multiple tools (search, calculator, database query) to answer questions
Click to view details and solution.
Implement a utility to count tokens in text and estimate API costs
Click to view details and solution.
Build a context management system that handles long conversations by intelligently truncating or summarizing old messages
Click to view details and solution.
Build a context management system that handles long conversations by intelligently truncating or summarizing old messages
Click to view details and solution.
Write a script to upload a training file and start a fine-tuning job using the OpenAI API
Click to view details and solution.
Implement audio transcription using the Whisper API
Click to view details and solution.
Build a moderation filter that checks user input against OpenAI's Moderation API before processing
Click to view details and solution.
Write a function that prepares embeddings for visualization by reducing dimensions (conceptual implementation)
Click to view details and solution.
Implement a function that guarantees structured JSON output from the LLM using the 'json_object' response format
Click to view details and solution.
Write code to send an image (url or base64) to GPT-4 Vision for analysis
Click to view details and solution.
Create a wrapper function that retries OpenAI API calls with exponential backoff on failure
Click to view details and solution.
Write a function that adjusts the system prompt based on user's skill level or preference
Click to view details and solution.
Implement a simple in-memory cache for embeddings to reduce API costs
Click to view details and solution.
Write code to generate spoken audio from text using OpenAI's TTS API
Click to view details and solution.
Design a Pastebin-like web service for storing and sharing text
Click to view details and solution.
Design a Distributed Key-Value Store like Dynamo or Cassandra
Click to view details and solution.
Design a scalable Web Crawler
Click to view details and solution.
Design a centralized Notification System (Push, Email, SMS)
Click to view details and solution.
Design a real-time Gaming Leaderboard
Click to view details and solution.
Design a distributed Unique ID Generator (like Twitter Snowflake)
Click to view details and solution.
Design a Typeahead/Autocomplete Suggestion System (like Google Search)
Click to view details and solution.
Design a Distributed Counter (e
Click to view details and solution.
Design a Consistent Hashing mechanism
Click to view details and solution.
Design an Object-Oriented system for a Parking Lot
Click to view details and solution.
Design an API Rate Limiter system
Click to view details and solution.
Design a Video Streaming Platform like Netflix
Click to view details and solution.
Design a Ticket Booking System (Ticketmaster)
Click to view details and solution.
Design a Ride Sharing Service like Uber
Click to view details and solution.
Design a Metrics Monitoring System (Datadog/Prometheus)
Click to view details and solution.
Design a Distributed Logging System
Click to view details and solution.
Design a 'Nearby Friends' service
Click to view details and solution.
Design a distributed Job Scheduler
Click to view details and solution.
Design a high-frequency Stock Exchange Trading System
Click to view details and solution.
Design an Object-Oriented Vending Machine
Click to view details and solution.
Design a file storage service like Google Drive or Dropbox
Click to view details and solution.
Design a News Feed Aggregator (like Google News)
Click to view details and solution.
Design a Real-time Web Analytics System (like Google Analytics)
Click to view details and solution.
How would you design a Content Delivery Network (CDN)?
Click to view details and solution.
Design a Chat System with End-to-End Encryption (like WhatsApp)
Click to view details and solution.
Create a simple HTTP server in Node
Click to view details and solution.
Read a text file asynchronously using 'fs' module
Click to view details and solution.
Implement a simple EventEmitter class
Click to view details and solution.
Copy a file using Streams (pipe)
Click to view details and solution.
Promisify fs
Click to view details and solution.
Write an Express middleware to log Request Method and URL
Click to view details and solution.
Sign a JWT token using 'jsonwebtoken' library
Click to view details and solution.
Create a simple GET /users endpoint with http module
Click to view details and solution.
Implement a basic logic for rate limiting (pseudo-code/simple js)
Click to view details and solution.
How to handle uncaught exceptions globally?
Click to view details and solution.
Write a SQL query to select all orders with customer names (Inner Join)
Click to view details and solution.
Define a simple Mongoose schema for a 'User' with name and email
Click to view details and solution.
Write an SQL query to count customers per country
Click to view details and solution.
SQL query to get all Customers and their Orders (if any) - Left Join
Click to view details and solution.
MongoDB: Calculate total sales amount per product using aggregation
Click to view details and solution.
Find duplicate emails in a Users table
Click to view details and solution.
Write a SQL query for pagination (Skip 20, Take 10)
Click to view details and solution.
Basic Redis set and get in Node
Click to view details and solution.
Pseudo-code for a DB transaction (Transfer money)
Click to view details and solution.
How to use 'populate' in Mongoose to get referenced data?
Click to view details and solution.
How to implement Soft Delete?
Click to view details and solution.
Update prices of all products in 'Electronics' category
Click to view details and solution.
Write a Dockerfile for a Node
Click to view details and solution.
Write a basic GitHub Actions workflow to run tests on push
Click to view details and solution.
Create a docker-compose
Click to view details and solution.
Write a simple Kubernetes Deployment YAML
Click to view details and solution.
Write a Kubernetes Service YAML to expose 'my-app'
Click to view details and solution.
Define an AWS S3 bucket in Terraform
Click to view details and solution.
Write a multi-stage Dockerfile for a Node
Click to view details and solution.
Configure Nginx as a reverse proxy for localhost:3000
Click to view details and solution.
Write a shell script to check if a website is up
Click to view details and solution.
Create a Makefile to build and test a project
Click to view details and solution.
Basic prometheus
Click to view details and solution.
Command to create a docker volume and mount it
Click to view details and solution.