Add Binary
Given two binary strings a and b, return their sum as a binary string.
Given two binary strings a and b, return their sum as a binary string.
Given the root of a binary tree, return the average value of the nodes on each level in the form of an array.
Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character.
Given a binary tree, determine if it is height-balanced.
You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums...
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
You are given a 0-indexed 1-dimensional (1D) integer array original, and two integers, m and n. You are tasked with creating a 2-dimensional (2D) array with m rows and n columns using all the elements from original.
Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree
Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.
Given the root of a binary tree, return the length of the diameter of the tree.
Given an array nums of n integers where nums[i] is in the range [1,n], return an array of all the integers in the range [1,n] that do not appear in nums.
Return the smallest character in letters that is lexicographically greater than target. If such a character does not exist, return the first character in letters.
Implement a function to find the first bad version. You should minimize the number of calls to the API.
An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image.
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue...
Given the root of a binary tree, invert the tree, and return its root.
Given head, the head of a linked list, determine if the linked list has a cycle in it.
Write a function to find the longest common prefix string amongst an array of strings.
Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.
Given an array nums of size n, return the majority element.
Given the root of a binary tree, return its maximum depth.
Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree.
You are given the heads of two sorted linked lists list1 and list2.
Given the head of a singly linked list, return the middle node of the linked list.
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.
Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight).
Given the head of a singly linked list, return true if it is a palindrome or false otherwise.
Given an integer x, return true if x is a palindrome, and false otherwise.
Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.
Calculate the sum of the elements of nums between indices left and right inclusive where left <= right.
Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise.
Given the head of a sorted linked list, delete all duplicates such that each element appears only once.
Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head.
Reverse bits of a given 32 bits unsigned integer.
Given the head of a singly linked list, reverse the list, and return the reversed list.
Given a roman numeral, convert it to an integer.
Given the roots of two binary trees p and q, write a function to check if they are the same or not.
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise.
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.