SlaveCode.

Your code is your master. Serve it well.

Master your skills with a comprehensive platform designed for growth. Access over 11,000+ coding problems, explore our Academy supporting 80 languages for beginners, and follow structured DSA roadmaps. Prepare for interviews with 470 company-specific questions, dive into System Design with detailed concepts and a fully-featured workspace, and more.

1. Two Sum

Easy
Array
Hash Table

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.

Example 1

Input: nums = [2,7,11,15], target = 9

Output: [0,1]

// Because nums[0] + nums[1] = 9

Example 2

Input: nums = [3,2,4], target = 6

Output: [1,2]

// Because nums[1] + nums[2] = 6

Constraints

  • 2 <= nums.length <= 104
  • -109 <= nums[i] <= 109
  • -109 <= target <= 109
  • Only one valid answer exists.
JAVA
1class Solution { 2 public int[] twoSum(int[] nums, int target) { 3 HashMap<Integer, Integer> map = new HashMap<>(); 4 5 for (int i = 0; i < nums.length; i++) { 6 int complement = target - nums[i]; 7 if (map.containsKey(complement)) { 8 return new int[] { map.get(complement), i }; 9 } 10 map.put(nums[i], i); 11 } 12 return new int[] {}; 13 } 14}

Master 3000+ Real Interview Problems

Everything you need to master your coding skills. From basic arrays to complex dynamic programming, practice in a fully-featured, distraction-free environment.

Explore All Problems

Academy

Perfect for beginners. Take your skills from basic to master across dozens of languages, complete with structured roadmaps, detailed concepts, and hands-on practice problems.

GleamGoGroovyHaskellIdrisJavaJavascriptjq

82 languages for you to master

Master your preferred programming languages through curated, structured learning tracks designed for deliberate practice.

Gleam icon

Gleam

142 exercises
Go icon

Go

98 exercises
Groovy icon

Groovy

115 exercises
Ba

Basics

0 / 1 exercise

Bo

Booleans

0 / 1 exercise

St

Strings

0 / 1 exercise

Every language has a properly structured track roadmap having all detailed concepts and exercises.

View Full Roadmap
Hello World

Hello World

SlaveCode's classic introductory exercise. Just say "Hello, World!".

Cook Your Lasagna

Cook Your Lasagna

Learn about the basics of Java by following a lasagna recipe.

Annalyn's Infiltration

Annalyn's Infiltration

Learn about booleans while helping Annalyn rescue her friend.

Each language has lots of basic to advanced questions to solve, so you can practice while learning.

Explore Practice Exercises

Roadmap

Master Data Structures and Algorithms in the perfect sequence.Track your progress as you unlock concepts from basic Arrays to advanced Graph theory.

Master Data Structures and Algorithms

Stop guessing what to learn next. Our interactive taxonomy roadmaps guide you through every concept of DSA in a highly structured, logical order.

Navigate through clearly defined subtopics from basic Arrays to complex Trees and Tries. Each topic is paired with targeted practice problems, allowing you to solve questions and track your true mastery as you conquer every node on the path.

Arrays

Stacks

Strings

LINKED LISTS

QUEUE / DEQUE

Hash map

TREES

Recursion

TRIE

Google
Meta
Amazon
Apple
Microsoft
Oracle
TCS
Infosys

470 companies for you to master

Master your preferred company questions through curated, structured learning tracks designed for deliberate practice.

Explore 470+ top tech companies. Each profile features real interview questions that you can solve directly in our built-in editor while tracking your success stats over time.

View all companies

System Design

Master system architecture with comprehensive learning modules. Dive deep into structured case studies and build real-world applications using our interactive workspace.

S3

56 topics for you to master

Master system design through structured, in-depth learning tracks. Dive into 56 essential topics and concepts designed for deliberate practice.

Topics

What is system design?

Before we start this course, let's talk about what even is system design.

System design is the process of defining the architecture, interfaces, and data for a system that satisfies specific requirements. System design meets the needs of your business or organization through coherent and efficient systems. It requires a systematic approach to building and engineering systems.

Why is it important?

System design helps us define a solution that meets the business requirements. It is one of the earliest decisions we can make when building a system. Often it is essential to think from a high level as these decisions are very difficult to correct later.

Design
Saved
Page 1
VPC Subnet
Main Server
Compute Nodes
API gatewayAPI gateway
LambdaLambda
ServerServer
DataData
QueueQueue
Worker3Worker1
Worker2Worker2
Worker1Worker1
S3S3
AnalyticsAnalytics

Master Architecture with Professional Tools

The interactive workspace gives you ultimate control to draw and learn. Access 3,900+ architecture icons, generate architectures via Code-to-Diagram, utilize AI design assistance, and explore a massive pre-built diagram catalog.

Explore Workspace

Arena

Challenge your friends and developers worldwide. Engage in real-time coding matches, climb the leaderboards, and sharpen your competitive programming skills.

20 mins

Arena Lobby

Maximum Sum Path Challenge

Medium
Java
Invite Code
82XJ-72

Participants :

4 / 50
AK
Alex K.
Host
@alexk
SJ
Sarah J.@sarahj
MR
Mike R.@miker
LD
Lisa D.@lisad
46 slots remaining

Host or Join a match

Select problems from our extensive catalog to host a custom coding match, or simply enter a pin code to join an active match. Compete in real-time against other challengers, global rankings and Arena Points are awarded based on your final rank and execution speed.

09:06

1. Two Sum

Easy
Array
Hash Table

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume each input has exactly one solution, and you may not use the same element twice. You can return the answer in any order.

Example 1

Input: nums = [2,7,11,15], target = 9

Output: [0,1]

// Because nums[0] + nums[1] = 9

Example 2

Input: nums = [3,2,4], target = 6

Output: [1,2]

// Because nums[1] + nums[2] = 6

Constraints

  • 2 <= nums.length <= 104
  • -109 <= nums[i] <= 109
  • -109 <= target <= 109
JAVA
1class Solution { 2 public int[] twoSum(int[] nums, int target) { 3 HashMap<Integer, Integer> map = new HashMap<>(); 4 5 for (int i = 0; i < nums.length; i++) { 6 int complement = target - nums[i]; 7 if (map.containsKey(complement)) { 8 return new int[] { map.get(complement), i }; 9 } 10 map.put(nums[i], i); 11 } 12 return new int[] {}; 13 } 14}

Fully-Featured Competitive Editor

Everything you need to dominate the match. Utilize the built-in scratchpad, keep pace with the live match timer, leverage instant test execution, and keep an eye on your competition with real-time tracking.

Enter the Arena

Global Contests

Never miss a coding competition again. We aggregate contests from all major platforms into one unified calendar.

Track every coding contest

We aggregate all coding contests from across the globe into a single, unified dashboard. Whether it's LeetCode, Codeforces, AtCoder, or CodeChef—view schedules at a glance and register with a single click.

LeetCode
LeetCode

Weekly Contest 400

Starts
Jun 10, 4:50 PM
Duration
1h 30m
Starts In
2 days
Register
Codeforces
Codeforces

Codeforces Round 950 (Div. 2)

Starts
Jun 12, 4:50 PM
Duration
2h 0m
Starts In
4 days
Register

Compiler Playground

A high-performance sandbox where you can code and test logic in multiple languages. Execute your scripts instantly in a distraction-free environment.

Python
INPUT
OUTPUT
1fn main() { 2 let a = 25; 3 let b = 17; 4 5 println!("Calculating sum..."); 6 println!("Sum of {} + {} is: {}", a, b, a + b); 7}
Result
Success
"Calculating sum...\nSum of 25 + 17 is: 42"

Powerful Execution Engine

Write, compile, and execute code in multiple languages instantly. Benefit from sub-second compilation, standard input support, and live console feedback in a distraction-free environment.

Open Compiler

Ready to Level Up? Start Your Journey.

Master your skills with a comprehensive platform. Access over 11,000+ coding problems, explore our Academy supporting 80 languages for beginners, and follow structured DSA roadmaps. Prepare for interviews with 470 company-specific questions, dive into System Design, and more.