自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Single Number

Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using e

2015-08-31 11:54:30 292

原创 House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2015-08-25 16:39:23 257

原创 Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 只有偶数和5(或5的倍数)相乘才会出现0,所以,可以在n之前看看有多少个偶数和5就行了,又发现偶数的数量一定多于5的个数,于是我们只看n

2015-08-24 21:46:59 282

原创 Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element

2015-08-22 10:50:46 270

原创 Compare Version Numbers

Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0. You may assume that the version strings are non-empty and cont

2015-08-21 20:22:47 273

原创 Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists:  A: a1 → a2 ↘

2015-08-21 15:10:35 235

原创 Binary Tree Paths

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"] /* use

2015-08-20 19:31:17 239

原创 Binary Tree Level Order Traversal

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,#,#,15,7}, 3 / \ 9 20

2015-08-15 18:05:40 236

原创 Climbing Stairs

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 climb to the top? 这题实际上和费波那契数列很像。上n层楼梯的方法总数s(n

2015-08-13 10:42:02 352

原创 int b[m][n]和int **b——关于数组名和指针的关系这件“小事”

#include int pa(int *a){ return a[3]; }; int pb(int **b){ return b[1][4]; }; int main(){ int a[] = { 1,2,3,4,5 }; int b[][5] = { {1,2,3,4,5},{6,7,8,9,10} }; printf("%d\t%d\n",a[3],b[1][4

2015-08-01 17:27:32 892

空空如也

空空如也

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

TA关注的人

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