SlaveCode LogoSlaveCode.
Academy
RoadmapProblemsSystem Design
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
SlaveCode LogoSlaveCode.

Standardize your coding journey. From basic academy courses and guided roadmaps to advanced system design, company interview prep, and real-time coding arenas. The all-in-one platform to master algorithms and prove your engineering excellence.

Officially Featured by Judge0

Learn & Practice

  • Academy
  • Problems
  • Roadmap
  • System Design
  • Companies

Compete & Tools

  • Arena
  • Contests
  • Compilers

Legal & Support

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

© 2026 SlaveCode. All rights reserved.

Java

Java

Java is a very widely used Object Oriented programming language. It's safe, simple to use and portable so that you can "write once, run anywhere".

Practice Challenges

Pick a problem and open it and solve it.

Hello World
Hello World
Level 1

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.

Bird Watcher
Bird Watcher

Learn about arrays by keeping track of how many birds visit your garden.

Karl's Languages
Karl's Languages

Learn about lists by helping Karl keep track of the languages he wants to learn on SlaveCode.

Calculator Conundrum
Calculator Conundrum

Learn about exception-handling by making a simple calculator.

Squeaky Clean
Squeaky Clean

Learn about characters and StringBuilder by cleaning strings.

Jedlik's Toy Car
Jedlik's Toy Car

Learn about classes by working on a remote controlled car.

Need for Speed
Need for Speed

Learn about classes by creating cars.

Remote Control Competition
Remote Control Competition

Learn about interfaces by working on cars.

Cars, Assemble!
Cars, Assemble!

Learn about numbers by analyzing the production of an assembly line.

Log Levels
Log Levels

Learn about strings by processing logs.

Salary Calculator
Salary Calculator

Learn about ternary operators by calculating salaries.

Football Match Reports
Football Match Reports

Learn about switches by developing a system to report on soccer matches.

Wizards and Warriors
Wizards and Warriors

Learn about inheritance by creating an RPG.

Logs, Logs, Logs!
Logs, Logs, Logs!

Learn about enums by parsing logs.

Tim from Marketing
Tim from Marketing

Learn about the null literal and nullable variables in java by printing name badges.

Captain's Log
Captain's Log

Learn about randomness by helping Mary generate stardates and starship registry numbers for her Star Trek themed pen-and-paper role playing sessions.

Booking Up For Beauty
Booking Up For Beauty

Learn about the LocalDate and LocalDateTime classes by working on an appointment scheduler for a beauty salon.

Wizards and Warriors 2
Wizards and Warriors 2

Learn about method overloading by extending your favorite RPG.

Secrets
Secrets

Learn about bit manipulation by writing a program to decrypt a message.

Gotta Snatch 'Em All
Gotta Snatch 'Em All

Learn to use sets by playing a vintage trading card game

International Calling Connoisseur
International Calling Connoisseur

Learn about maps while managing international calling codes.

Leap
Leap
Level 1

Determine whether a given year is a leap year.

Reverse String
Reverse String
Level 1

Reverse a given string.

Two Fer
Two Fer
Level 1

Create a sentence of the form "One for X, one for me.".

Armstrong Numbers
Armstrong Numbers
Level 2

Determine if a number is an Armstrong number.

Darts
Darts
Level 2

Calculate the points scored in a single toss of a Darts game.

D&D Character
D&D Character
Level 2

Randomly generate Dungeons & Dragons characters.

DOT DSL
DOT DSL
Level 2

Write a Domain Specific Language similar to the Graphviz dot language.

Grains
Grains
Level 2

Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.

High Scores
High Scores
Level 2

Manage a player's High Score list.

Resistor Color
Resistor Color
Level 2

Convert a resistor band's color to its numeric representation.

Resistor Color Duo
Resistor Color Duo
Level 2

Convert color codes, as used on resistors, to a numeric value.

Resistor Color Trio
Resistor Color Trio
Level 2

Convert color codes, as used on resistors, to a human-readable label.

RNA Transcription
RNA Transcription
Level 2

Given a DNA strand, return its RNA complement.

Acronym
Acronym
Level 3

Convert a long phrase to its acronym.

Difference of Squares
Difference of Squares
Level 3

Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.

Gigasecond
Gigasecond
Level 3

Given a moment, determine the moment that would be after a gigasecond has passed.

Hamming
Hamming
Level 3

Calculate the Hamming distance between two DNA strands.

Micro Blog
Micro Blog
Level 3

Given an input string, truncate it to 5 characters.

Pangram
Pangram
Level 3

Determine if a sentence is a pangram.

Perfect Numbers
Perfect Numbers
Level 3

Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.

Eliud's Eggs
Eliud's Eggs
Level 3

Help Eliud count the number of eggs in her chicken coop by counting the number of 1 bits in a binary representation.

Protein Translation
Protein Translation
Level 3

Translate RNA sequences into proteins.

Raindrops
Raindrops
Level 3

Convert a number into its corresponding raindrop sounds - Pling, Plang and Plong.

Say
Say
Level 3

Given a number from 0 to 999,999,999,999, spell out that number in English.

Scrabble Score
Scrabble Score
Level 3

Given a word, compute the Scrabble score for that word.

Secret Handshake
Secret Handshake
Level 3

Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.

Space Age
Space Age
Level 3

Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.

Collatz Conjecture
Collatz Conjecture
Level 4

Calculate the number of steps to reach 1 using the Collatz conjecture.

Diamond
Diamond
Level 4

Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.

Error Handling
Error Handling
Level 4

Implement various kinds of error handling and resource management.

ISBN Verifier
ISBN Verifier
Level 4

Check if a given string is a valid ISBN-10 number.

Isogram
Isogram
Level 4

Determine if a word or phrase is an isogram.

Killer Sudoku Helper
Killer Sudoku Helper
Level 4

Write a tool that makes it easier to solve Killer Sudokus

Kindergarten Garden
Kindergarten Garden
Level 4

Given a diagram, determine which plants each child in the kindergarten class is responsible for.

Largest Series Product
Largest Series Product
Level 4

Given a string of digits, calculate the largest product for a contiguous substring of digits of length n.

Luhn
Luhn
Level 4

Given a number determine whether or not it is valid per the Luhn formula.

Matrix
Matrix
Level 4

Given a string representing a matrix of numbers, return the rows and columns of that matrix.

Nth Prime
Nth Prime
Level 4

Given a number n, determine what the nth prime is.

Prism
Prism
Level 4

Calculate the path of a laser through refractive prisms.

Proverb
Proverb
Level 4

For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Output the full text of this proverbial rhyme.

Rate Limiter
Rate Limiter
Level 4

Practice stateful logic and time handling by implementing a fixed-window rate limiter

Rotational Cipher
Rotational Cipher
Level 4

Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.

Saddle Points
Saddle Points
Level 4

Detect saddle points in a matrix.

Sieve
Sieve
Level 4

Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.

Split-Second Stopwatch
Split-Second Stopwatch
Level 4

Keep track of time through a digital stopwatch.

Sum of Multiples
Sum of Multiples
Level 4

Given a number, find the sum of all the multiples of particular numbers up to but not including that number.

Swift Scheduling
Swift Scheduling
Level 4

Convert delivery date descriptions to actual delivery dates.

Triangle
Triangle
Level 4

Determine if a triangle is equilateral, isosceles, or scalene.

Twelve Days
Twelve Days
Level 4

Output the lyrics to 'The Twelve Days of Christmas'.

Variable Length Quantity
Variable Length Quantity
Level 4

Implement variable length quantity encoding and decoding.

Yacht
Yacht
Level 4

Score a single throw of dice in the game Yacht.

Allergies
Allergies
Level 5

Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.

Atbash Cipher
Atbash Cipher
Level 5

Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.

Bob
Bob
Level 5

Bob is a lackadaisical teenager. In conversation, his responses are very limited.

Flatten Array
Flatten Array
Level 5

Take a nested list and return a single list with all values except nil/null.

Conway's Game of Life
Conway's Game of Life
Level 5

Implement Conway's Game of Life.

Grep
Grep
Level 5

Search a file for lines matching a regular expression pattern. Return the line number and contents of each matching line.

Knapsack
Knapsack
Level 5

Given a knapsack that can only carry a certain weight, determine which items to put in the knapsack in order to maximize their combined value.

Ledger
Ledger
Level 5

Refactor a ledger printer.

Matching Brackets
Matching Brackets
Level 5

Make sure the brackets and braces all match.

Nucleotide Count
Nucleotide Count
Level 5

Given a DNA string, compute how many times each nucleotide occurs in the string.

Pascal's Triangle
Pascal's Triangle
Level 5

Compute Pascal's triangle up to a given number of rows.

Phone Number
Phone Number
Level 5

Clean up user-entered phone numbers so that they can be sent SMS messages.

Pig Latin
Pig Latin
Level 5

Implement a program that translates from English to Pig Latin.

Prime Factors
Prime Factors
Level 5

Compute the prime factors of a given natural number.

Relative Distance
Relative Distance
Level 5

Given a family tree, calculate the degree of separation.

Robot Name
Robot Name
Level 5

Manage robot factory settings.

Run-Length Encoding
Run-Length Encoding
Level 5

Implement run-length encoding and decoding.

Series
Series
Level 5

Given a string of digits, output all the contiguous substrings of length `n` in that string.

Square Root
Square Root
Level 5

Given a natural radicand, return its square root.

Word Count
Word Count
Level 5

Given a phrase, count the occurrences of each word in that phrase.

State Of Tic Tac Toe
State Of Tic Tac Toe
Level 5

Determine the game state of a match of Tic-Tac-Toe.

Affine Cipher
Affine Cipher
Level 6

Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.

All Your Base
All Your Base
Level 6

Convert a number, represented as a sequence of digits in one base, to any other base.

Alphametics
Alphametics
Level 6

Given an alphametics puzzle, find the correct solution.

Baffling Birthdays
Baffling Birthdays
Level 6

Estimate the birthday paradox's probabilities.

Bank Account
Bank Account
Level 6

Simulate a bank account supporting opening/closing, withdraws, and deposits of money. Watch out for concurrent transactions!

Binary Search
Binary Search
Level 6

Implement a binary search algorithm.

Bottle Song
Bottle Song
Level 6

Produce the lyrics to the popular children's repetitive song: Ten Green Bottles.

Bowling
Bowling
Level 6

Score a bowling game.

Camicia
Camicia
Level 6

Simulate the card game and determine whether the match ends or enters an infinite loop.

ETL
ETL
Level 6

Change the data format for scoring a game to more easily add other languages.

Flower Field
Flower Field
Level 6

Mark all the flowers in a garden.

Food Chain
Food Chain
Level 6

Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'.

Grade School
Grade School
Level 6

Given students' names along with the grade that they are in, create a roster for the school.

House
House
Level 6

Output the nursery rhyme 'This is the House that Jack Built'.

Intergalactic Transmission
Intergalactic Transmission
Level 6

Add parity bits to a message for transmission

Linked List
Linked List
Level 6

Implement a doubly linked list.

Parallel Letter Frequency
Parallel Letter Frequency
Level 6

Count the frequency of letters in texts using parallel computation.

Piecing It Together
Piecing It Together
Level 6

Fill in missing jigsaw puzzle details from partial data

Queen Attack
Queen Attack
Level 6

Given the position of two queens on a chess board, indicate whether or not they are positioned so that they can attack each other.

Rail Fence Cipher
Rail Fence Cipher
Level 6

Implement encoding and decoding for the rail fence cipher.

REST API
REST API
Level 6

Implement a RESTful API for tracking IOUs.

Robot Simulator
Robot Simulator
Level 6

Write a robot simulator.

Roman Numerals
Roman Numerals
Level 6

Convert modern Arabic numbers into Roman numerals.

Spiral Matrix
Spiral Matrix
Level 6

Given the size, return a square matrix of numbers in spiral order.

Tournament
Tournament
Level 6

Tally the results of a small football competition.

Transpose
Transpose
Level 6

Take input text and output it transposed.

Wordy
Wordy
Level 6

Parse and evaluate simple math word problems returning the answer as an integer.

Anagram
Anagram
Level 7

Given a word and a list of possible anagrams, select the correct sublist.

Binary Search Tree
Binary Search Tree
Level 7

Insert and search for numbers in a binary tree.

Clock
Clock
Level 7

Implement a clock that handles times without dates.

Crypto Square
Crypto Square
Level 7

Implement the classic method for composing secret messages called a square code.

Dominoes
Dominoes
Level 7

Make a chain of dominoes.

Go Counting
Go Counting
Level 7

Count the scored points on a Go board.

Markdown
Markdown
Level 7

Refactor a Markdown parser.

Meetup
Meetup
Level 7

Calculate the date of meetups.

Poker
Poker
Level 7

Pick the best hand(s) from a list of poker hands.

SGF Parsing
SGF Parsing
Level 7

Parsing a Smart Game Format string.

Simple Linked List
Simple Linked List
Level 7

Write a simple linked list implementation that uses Elements and a List.

Sublist
Sublist
Level 7

Write a function to determine if a list is a sublist of another list.

Tree Building
Tree Building
Level 7

Refactor a tree building algorithm.

Two Bucket
Two Bucket
Level 7

Given two buckets of different size, demonstrate how to measure an exact number of liters.

Word Search
Word Search
Level 7

Create a program to solve a word search puzzle.

Zebra Puzzle
Zebra Puzzle
Level 7

Solve the zebra puzzle.

Zipper
Zipper
Level 7

Creating a zipper for a binary tree.

Book Store
Book Store
Level 8

To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.

Change
Change
Level 8

Correctly determine change to be given using the least number of coins.

Circular Buffer
Circular Buffer
Level 8

A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.

Complex Numbers
Complex Numbers
Level 8

Implement complex numbers.

Connect
Connect
Level 8

Compute the result for a game of Hex / Polygon.

Hangman
Hangman
Level 8

Implement the logic of the hangman game using functional reactive programming.

List Ops
List Ops
Level 8

Implement basic list operations.

Mazy Mice
Mazy Mice
Level 8

Meet Mickey and Minerva, two clever mice who love to navigate their way through a maze to find cheese. They enjoy a good challenge, but with only their tiny mouse brains, they prefer if there is only one correct path to the cheese.

OCR Numbers
OCR Numbers
Level 8

Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled.

Palindrome Products
Palindrome Products
Level 8

Detect palindrome products in a given range.

POV
POV
Level 8

Reparent a graph on a selected node.

Rational Numbers
Rational Numbers
Level 8

Implement rational numbers.

React
React
Level 8

Implement a basic reactive system.

Rectangles
Rectangles
Level 8

Count the rectangles in an ASCII diagram.

Simple Cipher
Simple Cipher
Level 8

Implement the Vigenère cipher, a simple substitution cipher.

Forth
Forth
Level 9

Implement an evaluator for a very simple subset of Forth.

Pythagorean Triplet
Pythagorean Triplet
Level 9

Given an integer N, find all Pythagorean triplets for which a + b + c = N.

Custom Set
Custom Set
Level 10

Create a custom set type.

Satellite
Satellite
Level 10

Rebuild binary trees from pre-order and in-order traversals.