Master AP CS.
Ace the Exam.

Run real Java code in your browser. Get instant test feedback, and problems built specifically for AP Computer Science A* students — no setup required.

TwoSum.java
public class TwoSum {
  // Return indices that sum to target
  public int[] twoSum(int[] nums, int target) {
    Map<Integer, Integer> map =
        new HashMap<>();
    for (int i = 0; i < nums.length; i++) {
      int diff = target - nums[i];
      if (map.containsKey(diff))
        return new int[] { map.get(diff), i };
      map.put(nums[i], i);
    }
    return new int[] {};
  }
}
3 / 3 test cases passed
What you get

Everything you need to prepare.

Built specifically for AP Computer Science A — no bloat, no distractions, just the tools that matter.

Real Java IDE

A live Java editor in your browser, powered by Judge0. Write, run, and debug without installing anything.

🎯

Instant Feedback

Submit your solution and see exactly which test cases pass or fail, including hidden cases that mirror real exam grading.

📐

Curated Problems

Handpicked problems from Easy to Hard, mapped to AP CS A curriculum: arrays, recursion, OOP, data structures, and more.

Ready to start coding?

Free problems available instantly — no credit card required.
Unlock premium problems anytime for $14.95.

Create Free Account
An unhandled error has occurred. Reload 🗙