Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.…
标签:LeetCode题目解答汇总
LeetCode | Length of Last Word(最后一个单词的长度)
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return …
LeetCode | Integer to Roman(整数转换成罗马数字)
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 关于…
LeetCode | Maximum Depth of Binary Tree(二叉树的深度)
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path f…
LeetCode | Evaluate Reverse Polish Notation(逆波兰式求值)
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +,&nb…
LeetCode | Trapping Rain Water(柱子间存储的水容量)
Given n non-negative integers representing an elevation map where the width of each bar is 1, comput…
LeetCode | 4Sum(四个数的和)
Given an array S of n integers, are there elements a, b, c, and d …
LeetCode | Search Insert Position(查找插入位置)
Given a sorted array and a target value, return the index if the target is found. If not, return the index whe…
LeetCode | Multiply Strings(字符串相乘)
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers …
LeetCode | Minimum Depth of Binary Tree(树的最短路径)
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path …
LeetCode | Sum Root to Leaf Numbers(所有根结点到叶节点路径和的和)
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number…
LeetCode | Pow(x, n)
实现double Pow(double x,int n)—-x的n次幂! 题目解析: 这道题目看起来很简单,笨方法,可以一次一次的去乘,也可以折半相乘!看似简单,但中间碰到了不小的问题。 在运行过程中,出现了…