Chinaunix首页 | 论坛 | 博客
  • 博客访问: 117155
  • 博文数量: 53
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 620
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-24 16:22
文章存档

2014年(53)

我的朋友

发布时间:2014-12-06 15:36:05

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Show TagsHave you met t.........【阅读全文】

阅读(722) | 评论(0) | 转发(0)

发布时间:2014-12-06 15:30:01

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following is not: 1 / \ 2 2 \ \ 3 3判断一棵树是不是镜像。关于树,直接的.........【阅读全文】

阅读(822) | 评论(0) | 转发(0)

发布时间:2014-11-22 09:33:17

查找届跟排序届不同,面试常用的算法就这么一种,二分查找。二分查找看似容易,其实写得完全正确还是挺难的,下面总结一下规律。一个普通的二分查找int search(vector<int>& v,int target){    int left=0;    int right=v.size()-1;    while(left<=right){      &nb.........【阅读全文】

阅读(970) | 评论(0) | 转发(0)

发布时间:2014-10-07 15:30:17

Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.我试着用了最简单的匹配,居然过了,以后再用KMP之类的好好研究一下。char *strStr(char *haystack, char *needle) {    .........【阅读全文】

阅读(981) | 评论(0) | 转发(0)

发布时间:2014-10-07 15:26:48

Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.H.........【阅读全文】

阅读(810) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册