随笔分类 -  LeetCode 一步两步似爪牙

摘要:Given an array of integers, every element appears twice except for one. Find that single one. 这道题看似很简单,但是需要线性时间和不消耗额外空间,这里需要用到c++的“亦或”操作,因为 相同数数字 ^ 操作 阅读全文
posted @ 2016-09-08 22:13 熊阳 阅读(133) 评论(0) 推荐(0)
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2016-09-06 22:49 熊阳 阅读(106) 评论(0) 推荐(0)
摘要:把我难哭了 T T 目前还在想第二种方法。。。。 耗时5小时总算想出来了。。。。 前面一种方法用的递归,下面的方法用的是迭代,要比递归快的多。 不容易啊! 阅读全文
posted @ 2016-03-25 09:08 熊阳 阅读(331) 评论(0) 推荐(0)
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2016-03-24 07:01 熊阳 阅读(597) 评论(0) 推荐(0)
摘要:Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2. Your algorithm s 阅读全文
posted @ 2016-03-23 11:33 熊阳 阅读(341) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat 阅读全文
posted @ 2016-02-24 23:00 熊阳 阅读(157) 评论(0) 推荐(0)
摘要:Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the or 阅读全文
posted @ 2015-11-17 08:00 熊阳 阅读(143) 评论(0) 推荐(0)
摘要:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文
posted @ 2015-11-12 05:46 熊阳 阅读(281) 评论(0) 推荐(0)
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl... 阅读全文
posted @ 2015-11-12 03:53 熊阳 阅读(152) 评论(0) 推荐(0)
摘要:You are given a string,s, and a list of words,words, that are all of the same length. Find all starting indices of substring(s) insthat is a concatena... 阅读全文
posted @ 2015-11-09 10:44 熊阳 阅读(5291) 评论(0) 推荐(0)