Practice

Data Structures & Algorithms

Track your problem-solving mastery and identify weak topics.

Topic Mastery

Solve problems to generate mastery analytics.

All
Arrays
Strings
Hashing
Two Pointers
Linked List
Trees
Graphs
Dynamic Programming
Stack

Two Sum

Easy

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

Topic: Arrays

Best Time to Buy and Sell Stock

Easy

You are given an array prices where prices[i] is the price of a given stock on the ith day.

Topic: Arrays

Container With Most Water

Medium

Find two lines that together with the x-axis form a container, such that the container contains the most water.

Topic: Arrays

Valid Palindrome

Easy

Given a string s, return true if it is a palindrome, or false otherwise.

Topic: Strings

Longest Substring Without Repeating Characters

Medium

Given a string s, find the length of the longest substring without repeating characters.

Topic: Strings

Contains Duplicate

Easy

Given an integer array nums, return true if any value appears at least twice in the array.

Topic: Hashing

3Sum

Medium

Find all unique triplets in the array which gives the sum of zero.

Topic: Two Pointers

Reverse Linked List

Easy

Given the head of a singly linked list, reverse the list, and return the reversed list.

Topic: Linked List

Linked List Cycle

Medium

Given head, the head of a linked list, determine if the linked list has a cycle in it.

Topic: Linked List

Maximum Depth of Binary Tree

Easy

Given the root of a binary tree, return its maximum depth.

Topic: Trees

Lowest Common Ancestor of a Binary Tree

Medium

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

Topic: Trees

Number of Islands

Medium

Given an m x n 2D binary grid grid which represents a map of 1s (land) and 0s (water), return the number of islands.

Topic: Graphs

Climbing Stairs

Easy

You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps.

Topic: Dynamic Programming

Coin Change

Medium

Return the fewest number of coins that you need to make up that amount.

Topic: Dynamic Programming

Valid Parentheses

Easy

Given a string s containing just the characters (, ), {, }, [, and ], determine if the input string is valid.

Topic: Stack