自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 资源 (1)
  • 收藏
  • 关注

原创 求一棵树的镜像

给定一棵二叉树,返回该二叉树的镜像,即对于每一棵子树,都把其左右子树jiaohuan

2014-04-29 15:23:36 720

原创 统计1的数目

给定一个十进制数N,统计从1开始到N的所有整数中1出现的次数N=2s

2014-04-28 19:33:41 834

原创 Median of Two Sorted Arrays

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).给定两个sort以后的数组,求两个数组中的中位数。

2014-04-28 14:25:33 720

原创 Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2014-04-22 12:39:35 535

原创 Word Search

Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically

2014-04-22 00:27:48 404

原创 k个盘子放n个苹果

一道经典的dp题目

2014-04-19 20:28:57 728

原创 函数参数进栈以及自增运算在函数调用中的trick

之前看到个题目int k = 1;printf("%d,%d\n",k,k++);答案显而易见是2 1, 因为函数调用时,参数的进栈顺序是从右向左,所以是先将k++进栈,即此时第二个参数值是1,但是k已经自增为2于是我就抱着好玩儿的心态试试:int k = 1;printf("%d,%d\n",++k,++k);我预期的结果是3 2但是结果是3 3我有点

2014-04-03 19:27:38 1356

原创 寻找第k个丑数

Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.一个数的质因数只有3,5和7,找出第k个这样的数。

2014-04-03 19:10:23 817

原创 Recover Binary Search Tree

Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devis

2014-04-02 21:56:48 631

原创 显式调用析构函数

今天在复习shallow copy和deep copy的时候,为了重现shallow copy带来的问题,我写了下面一段代码class Node{public: int *num; Node(){num = new int[100];for(int i=0;i<100;i++) num[i]=0;} ~Node(){delete[] num;cout<<"destruct"<<en

2014-04-02 20:07:16 1527

原创 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()

2014-04-01 20:14:15 551

ping的综合概要(实用)

通过这个文档完全可以初步了解并掌握ping的应用方法!!!

2010-04-13

空空如也

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

TA关注的人

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