Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortes…
标签:LeetCode题目解答
[LeetCode] Binary Tree Postorder Traversal 二叉树的后序遍历
Given a binary tree, return the postorder traversal of its nodes’ values. For example: Given bina…
[LeetCode] Best Time to Buy and Sell Stock IV 买卖股票的最佳时间之四
Say you have an array for which the ith element is the price of a given stock on day i. …
LeetCode总结
最近完成了www.leetcode.com的online judge中151道算法题目。除各个题目有特殊巧妙的解法以外,大部分题目都是经典的算法或者数据结构,因此做了如下小结,具体的解题思路可以搜索我的博客:LeetCo…
[Leetcode] Search for a Range 寻找区间
Search for a Range Given a sorted array of integers, find the starting and ending position of a given target v…
【leetcode】21. Merge Two Sorted Lists 两个有序链表的归并有序
1. 题目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing toget…
[LeetCode] 4Sum 四数之和,Two Sum,3Sum,3Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target…
[LeetCode] Longest Repeating Character Replacement 最长重复字符置换
Given a string that consists of only uppercase English letters, you can replace any letter in the strin…
【leetcode】101. Symmetric Tree 二叉树是否是镜像结构
1. 题目 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For examp…
CareerCup All in One 题目汇总
Chapter 1. Arrays and Strings 1.1 Unique Characters of a String 1.2 Reverse String 1.3 Permutation Stri…
[LeetCode] Valid Phone Numbers 验证电话号码
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash s…
[LeetCode] Insert into a Binary Search Tree 二叉搜索树中插入结点
Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert…