自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 [leetcode]438. Find All Anagrams in a String

题目链接:https://leetcode.com/problems/find-all-anagrams-in-a-string/Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase Engl

2016-10-27 16:34:16 421

原创 [leetcode]172. Factorial Trailing Zeroes

题目:https://leetcode.com/problems/factorial-trailing-zeroes/Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.class Solutio

2016-10-26 20:02:37 186

原创 [leetcode]232. Implement Queue using Stacks

题目链接:https://leetcode.com/problems/implement-queue-using-stacks/Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the ele

2016-10-26 19:38:37 164

原创 [leetcode]110. Balanced Binary Tree

题目链接:https://leetcode.com/problems/balanced-binary-tree/Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in whi

2016-10-25 21:34:41 226

原创 [leetcode]141. Linked List Cycle

题目链接:https://leetcode.com/problems/linked-list-cycle/Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?class Solution {pu

2016-10-25 19:59:18 333

原创 [leetcode]263. Ugly Number

题目链接:https://leetcode.com/problems/ugly-number/Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For e

2016-10-22 12:03:04 231

原创 [leetcode]70. Climbing Stairs

题目链接:https://leetcode.com/problems/climbing-stairs/有三种方法:递归、斐波那契数列、动态规划第一种:递归class Solution{ public: int climbStairs(int n) { i

2016-10-22 10:57:20 253

原创 [leetcode]121. Best Time to Buy and Sell Stock

题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to comple

2016-10-21 10:32:33 243

原创 [leetcode]405. Convert a Number to Hexadecimal

题目链接:https://leetcode.com/problems/convert-a-number-to-hexadecimal/Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.No

2016-10-18 21:20:43 298

原创 [leetcode]401. Binary Watch

题目链接:https://leetcode.com/problems/binary-watch/A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED repr

2016-10-18 18:53:07 286

原创 [leetcode]226. Invert Binary Tree

题目链接:https://leetcode.com/problems/invert-binary-tree/Invert a binary tree.class Solution{ public: TreeNode * invertTree(TreeNode * root) {

2016-10-14 16:35:32 238

原创 [leetcode]371. Sum of Two Integers

题目链接: https://leetcode.com/problems/sum-of-two-integers/思路: 这里用到了一个半加法的思想, 即两位单独的位相加其结果可以用异或得到, 进位可以用与得到. 然后对于两个数字来说同样可以延伸这个思想. 举个例子: 11+5, 其二进制形式为11: 1011, 7: 01111. 两个位置都为1的地方就需要进位,那么0011=1011

2016-10-14 14:40:52 291

原创 [leetcode]104. Maximum Depth of Binary Tree

class Solution{ public: int maxDepth(TreeNode * root) { if(root==NULL) return 0;

2016-10-14 09:20:53 191 1

原创 371. Sum of Two Integers

题目链接: https://leetcode.com/problems/sum-of-two-integers/Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.思路: 这里用到了

2016-10-13 23:38:15 79

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除