ntree.ai

Prepare for your coding interviewwith genuinely better tools

  • Visualise your code line by line with an actual debugger
  • Understand algorithms with animated illustrations
  • Check your solution against every test case
0:00 / —

A real debugger that can visualise data structures

This is an actual debugger, it runs your code and shows deterministic results line-by-line. It draws variables, stack frames, objects and pointers, and identifies common data structures like arrays, hash tables, stacks, queues, linked lists, trees, graphs, etc.

Two Sum

Given an array of integers nums and an integer target, return the indexes of the two numbers that add up to target.

def twoSum(nums: list[int], target: int) -> list[int]:
seen = {}
for i, n in enumerate(nums):
if target - n in seen:
return [seen[target - n], i]
seen[n] = i
raise ValueError('no answer')
Two Sum
1 / 16

Being able to explain how your code runs is an important signal in a real interview.

Animated illustrations

Each problem comes with illustrated solutions.

1 → 2 → 3 → 2 → 1 slowfastleftright
move slow 1 step, fast 2 steps
1 / 8

Palindrome Linked List

Given the head of a singly linked list, return true if the values read the same forwards and backwards.

Implement
[2, 6]
[15, 18]
[1, 3]
[8, 10]
merged
05101520
Sort the intervals
1 / 6

Merge Intervals

Given an array of intervals where intervals[i] = [start, end], return a new array with overlapping intervals merged.

Implement
012345
lo hi
area = 5 * 2 = 10, largest_area = 10
1 / 6

Container With Most Water

You are given an integer array lines, where each element is the height of a vertical line standing at that index. Two lines and the axis between them form a container. Find the two lines that form the largest container and return its area.

Implement
1
1
0
0
1
0
0
1
0
0
1
1
0
0
1
0
land, size = 1
1 / 40

Largest Island

You are given an m x n matrix grid of 0s and 1s, where 1 is land and 0 is water. Land cells joined horizontally or vertically form an island. Return the number of land cells in the largest island, or 0 if there is no land.

Implement

Free, no signup

Explore problems and studies, run the code, and visualise it a few times without signing in. Sign in for unlimited visualisation, submissions and progress tracking.

Common questions

What languages are supported?

Python, JavaScript and Java today, and we are working on adding more. Let us know if you need another language supported.