SlaveCode LogoSlaveCode.
AcademySystem Design
SlaveCode LogoSlaveCode.

Standardize your coding journey. From interactive academy courses, guided roadmaps, and developer projects to advanced system design, company interview prep, and real-time coding arenas.

Officially Featured by Judge0

DSA & Practice

  • Problems
  • DSA Roadmap
  • Arena
  • Company Questions

Resources & Learn

  • Developer Roadmaps
  • Developer Projects
  • Academy
  • System Design

Compete & Tools

  • Contests
  • Compilers
  • Leaderboard

Legal & Support

  • Report an Issue
  • Privacy Policy
  • Terms of Service
  • Contact Us

© 2026 SlaveCode. All rights reserved.

SlaveCodeThe Ultimate Platform for Software Engineers.

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, follow structured DSA roadmaps, explore 90+ career Resources, and build real-world Projects. Prepare for interviews with 460+ company-specific questions, dive into System Design with detailed concepts and a fully-featured AI-Powered Workspace, and more.

Officially Featured by Judge0
09:06
Description
Hints
Solutions
Submissions

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.

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