
LeetCode
文章平均质量分 59
THEONE10211024
GitHub:https://github.com/THEONE10211024
展开
-
整理leetCode算法系列
leetCode是目前一个针对面试算法比较好的oj平台,上面有常见的、新鲜的面试算法题目。在刷了一部分题目之后,我觉得针对一道题目,AC不是最后的目的。一道好的题目,不是一次AC就能说明你已经解决这道问题。代码的效率、整洁性、其他解决思路或者一些别人用到的而你不知道的小技巧都应该是在AC后值得慢慢研读、学习和做笔记的。因此,我觉得有必要将之前做过的题目整理下来,相信会有不少的收获!在此之前,我原创 2015-10-13 14:27:04 · 833 阅读 · 0 评论 -
一、Two Sum
Two Sum Given an arrayof integers, find two numbers such that they add up to a specific targetnumber.The functiontwoSum should return indices of the two numbers such that they add up to thetarge原创 2015-10-13 16:01:44 · 555 阅读 · 0 评论 -
Subsets
题目描述:Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[ [3],原创 2017-10-30 15:16:37 · 1324 阅读 · 0 评论 -
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 from the root node down to the nearest leaf node.分析:题目让求的是从根节点到叶子节点的最"矮"树高度,可采用递归。递归计算原创 2017-10-30 15:21:29 · 391 阅读 · 0 评论 -
Two Sum IV - Input is a BST
题目描述:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1:Input: 5 / \ 3 6 / \ \原创 2017-10-30 15:26:16 · 451 阅读 · 0 评论 -
Maximum Product of Word Lengths
题目描述:Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case原创 2017-10-30 15:33:07 · 550 阅读 · 0 评论 -
Minimum Moves to Equal Array Elements II
题目描述:Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected elemen原创 2017-10-30 15:40:39 · 539 阅读 · 0 评论 -
Valid Square
题目描述:Given the coordinates of four points in 2D space, return whether the four points could construct a square.The coordinate (x,y) of a point is represented by an integer array with two integers.Exam原创 2017-11-01 13:03:58 · 1549 阅读 · 0 评论 -
Populating Next Right Pointers in Each Node
Given a binary treestruct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there is no原创 2017-11-05 11:24:01 · 703 阅读 · 0 评论