Practice
Data Structures & Algorithms
Track your problem-solving mastery and identify weak topics.
Solve problems to generate mastery analytics.
Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
Best Time to Buy and Sell Stock
You are given an array prices where prices[i] is the price of a given stock on the ith day.
Container With Most Water
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Valid Palindrome
Given a string s, return true if it is a palindrome, or false otherwise.
Longest Substring Without Repeating Characters
Given a string s, find the length of the longest substring without repeating characters.
Contains Duplicate
Given an integer array nums, return true if any value appears at least twice in the array.
3Sum
Find all unique triplets in the array which gives the sum of zero.
Reverse Linked List
Given the head of a singly linked list, reverse the list, and return the reversed list.
Linked List Cycle
Given head, the head of a linked list, determine if the linked list has a cycle in it.
Maximum Depth of Binary Tree
Given the root of a binary tree, return its maximum depth.
Lowest Common Ancestor of a Binary Tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
Number of Islands
Given an m x n 2D binary grid grid which represents a map of 1s (land) and 0s (water), return the number of islands.
Climbing Stairs
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps.
Coin Change
Return the fewest number of coins that you need to make up that amount.
Valid Parentheses
Given a string s containing just the characters (, ), {, }, [, and ], determine if the input string is valid.