随笔分类 -  LeetCode

摘要:题目: Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution 阅读全文
posted @ 2016-03-18 15:37 Gu Feiyang 阅读(112) 评论(0) 推荐(0)
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
posted @ 2016-03-18 13:24 Gu Feiyang 阅读(113) 评论(0) 推荐(0)
摘要:题意: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the bal 阅读全文
posted @ 2016-03-17 21:58 Gu Feiyang 阅读(124) 评论(0) 推荐(0)
摘要:题意: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exi 阅读全文
posted @ 2016-03-16 23:13 Gu Feiyang 阅读(134) 评论(0) 推荐(0)
摘要:题意: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get 阅读全文
posted @ 2016-03-15 22:11 Gu Feiyang 阅读(191) 评论(0) 推荐(0)
摘要:题目: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 思路: 这道题目并不难。暴力枚举其它点与当前点的斜率。 复杂度为 O(n^2). 可能是由于 阅读全文
posted @ 2016-03-13 17:29 Gu Feiyang 阅读(183) 评论(0) 推荐(0)
摘要:转载请注明出处: http://www.cnblogs.com/gufeiyang 个人微博:flysea_gu 题意: Given two words (beginWord and endWord), and a dictionary's word list, find the length of 阅读全文
posted @ 2016-02-20 17:02 Gu Feiyang 阅读(109) 评论(0) 推荐(0)
摘要:转载请注明出处: http://www.cnblogs.com/gufeiyang 个人微博:flysea_gu 题意: Merge two sorted linked lists and return it as a new list. The new list should be made by 阅读全文
posted @ 2016-02-20 16:06 Gu Feiyang 阅读(334) 评论(0) 推荐(0)
摘要:转载请注明出处: http://www.cnblogs.com/gufeiyang 个人微博:flysea_gu 题目描述: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix 阅读全文
posted @ 2016-02-20 15:40 Gu Feiyang 阅读(219) 评论(0) 推荐(0)
摘要:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路:坐标是i,j的元素旋转90坐标变... 阅读全文
posted @ 2015-02-05 13:38 Gu Feiyang 阅读(168) 评论(0) 推荐(0)