摘要: 图论的常见题目有两类,一类是求两点间最短距离,另一类是拓扑排序,两种写起来都很烦。 求最短路径: 127. Word Ladder Given two words (beginWord and endWord), and a dictionary's word list, find the leng 阅读全文
posted @ 2016-12-29 12:23 Gryffin 阅读(1287) 评论(0) 推荐(0)
摘要: 12. 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] 12. Intege 阅读全文
posted @ 2016-12-29 10:30 Gryffin 阅读(162) 评论(0) 推荐(0)
摘要: 94. Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], 阅读全文
posted @ 2016-12-29 09:19 Gryffin 阅读(176) 评论(0) 推荐(0)
摘要: 1. 普通的二分法查找查找等于target的数字 2. 还可以查找小于target的数字中最小的数字和大于target的数字中最大的数字 由于新的查找结果总是比旧的查找结果更接近于target,因此只需不停更新result 3. 查找最接近于target的数字 这种情况下,新的查找结果不一定比旧的查 阅读全文
posted @ 2016-12-29 05:18 Gryffin 阅读(265) 评论(0) 推荐(0)
摘要: 链表: 61. Rotate List Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1->2->3->4->5->NULL and k = 2,r 阅读全文
posted @ 2016-12-29 05:13 Gryffin 阅读(125) 评论(0) 推荐(0)
摘要: 75. Sort Colors Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in 阅读全文
posted @ 2016-12-29 04:36 Gryffin 阅读(219) 评论(0) 推荐(0)
摘要: 71. Simplify Path Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c 阅读全文
posted @ 2016-12-29 03:47 Gryffin 阅读(325) 评论(0) 推荐(0)