Leetcode Solutions [Solved] Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root. It is guaranteed that there is always possible to find a binary search tree with the given requirements for the given test cases. [Solved] Given a string array words, return an array of all characters that show up in all strings within the words (including duplicates). You may return the answer in any order. [Solved] In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. [Solved] Given the root of a binary tree with unique values and the values of two different nodes of the tree x and y, return true if the nodes corresponding to the values x and y in the tree are cousins, or false otherwise. [Solved] Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. [Solved] A binary tree is uni-valued if every node in the tree has the same value. Given the root of a binary tree, return true if the given tree is uni-valued, or false otherwise. [Solved] You are given an integer array nums with the following properties: nums.length == 2 * n. nums contains n + 1 unique elements. Exactly one element of nums is repeated n times. [Solved] You are given an array of n strings strs, all of the same length. The strings can be arranged such that there is one on each line, making a grid. For example, strs = [“abc”, “bce”, “cae”] can be arranged as: [Solved] A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: s[i] == ‘I’ if perm[i] < perm[i + 1], and s[i] == 'D' if perm[i] > perm[i + 1]. [Solved] Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high]. [Solved] Every valid email consists of a local name and a domain name, separated by the ‘@’ sign. Besides lowercase letters, the email may contain one or more ‘.’ or ‘+’. For example, in “alice@leetcode.com”, “alice” is the local name, and “leetcode.com” is the domain name. [Solved] Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times. [Solved] Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. [Solved] Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. [Solved] A sentence is a string of single-space separated words where each word consists only of lowercase letters. [Solved] Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. [Solved] Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence. [Solved] Given a 2D integer array matrix, return the transpose of matrix. The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix’s row and column indices. [Solved] An array arr a mountain if the following properties hold: arr.length >= 3, There exists some i with 0 < i < arr.length - 1 such that: [Solved] Given two strings s and t, return true if they are equal when both are typed into empty text editors. ‘#’ means a backspace character. «Previous Page 1 2 3 4 5 6 … 14 Next Page»