自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

我心中有猛虎 细嗅蔷薇

talk is cheap show me the code

  • 博客(13)
  • 收藏
  • 关注

原创 Leetcode Find Peak Element 162

A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that case

2017-01-14 20:33:12 590

原创 Leetcode Third Maximum Number 414

Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1: Input: [3, 2, 1]Outp

2017-01-13 16:35:35 465

原创 Leetcode Guess Number Higher or Lower 374

We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I’ll tell you whether the number is higher or lowe

2017-01-10 20:47:54 346

原创 leetcode Binary Tree Paths 257

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree:1 / \ 2 3 \ 5 All root-to-leaf paths are:[“1->2->5”, “1->3”]题目链接要找出所有的路径,考虑使用dfs/** * Def

2017-01-10 20:31:52 336

原创 Leetcode Factorial Trailing Zeroes 172

Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits: Special thanks to @ts for adding this problem and creating all test

2017-01-10 20:05:54 381

原创 Leetcode Binary Tree Level Order Traversal 102

Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20

2017-01-05 20:47:12 370

原创 快速的判断一个数是不是2,3,4的幂

1.判断是不是2的幂: 如果n是2的幂二进制中有一位是1,n-1的二进制表示中剩下的都是1 则判断用n&(n-1) 如果是0 就是2的幂2.判断是不是4的幂: 如果n是4的幂,首先是2的幂:n&(n-1)=0 然后看是否在1的位置是不是在偶数位 n&(0x55555555) 为1 || n&(0xaa

2017-01-03 17:32:53 922

原创 Leetcode Convert a Number to Hexadecimal 405

Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase. The hexadecimal str

2017-01-03 16:42:44 362

原创 Leetcode Longest Valid Parentheses 32

Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which has

2017-01-02 15:58:55 337

原创 Leetcode Longest Palindromic Substring 5

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “bab”Note: “aba” is also a valid answer. Example:Input:

2017-01-01 18:09:39 309

原创 Leetcode Reverse Linked List II 92

Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following co

2017-01-01 15:28:43 426

原创 Leetcode Reorder List 143

Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes’ values.For example, Given {1,2,3,4}, reorder it to {1,4,2,3}

2017-01-01 14:32:31 344

原创 Leetcode Remove Duplicates from Sorted List II 82

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2

2017-01-01 11:30:44 465

空空如也

空空如也

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

TA关注的人

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