- 博客(194)
- 资源 (3)
- 收藏
- 关注
原创 Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. You m
2014-05-23 19:59:32 1406
原创 Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2014-05-23 19:46:25 679
原创 Rotate List
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.循环列表应用
2014-05-23 19:29:08 749
原创 Remove Duplicates from Sorted List II
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
2014-05-23 18:35:21 858
原创 Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.henjianda
2014-05-23 16:14:46 847
原创 Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of t
2014-05-23 15:59:54 634
原创 Reverse Linked List II
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 fol
2014-05-22 23:24:03 553
原创 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2014-05-22 21:02:56 632
原创 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements
2014-05-21 22:58:38 990
原创 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact
2014-05-20 00:00:05 838
原创 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c)
2014-05-19 19:44:39 884
原创 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe
2014-05-14 23:27:55 715
原创 Symmetric Tree
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 f
2014-05-14 21:10:51 705
原创 Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.判断两棵树是否x
2014-05-14 20:07:26 712
原创 Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7},
2014-05-14 19:24:48 1327
原创 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
2014-05-14 18:59:52 6690 2
原创 Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solutio
2014-05-13 17:05:22 797
原创 Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti
2014-05-13 16:41:02 731
原创 Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3
2014-05-08 16:25:33 2312
原创 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)).
2014-05-06 16:52:35 877
原创 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur
2014-05-02 15:52:40 741
原创 Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2014-04-30 22:25:29 550
转载 网站资源
http://search.csdn.net/CSDN搜索,CSDN还是有非常多的编程资源的,用它的搜索能搜出不少东西。代码类别也比较全面。http://snippets.org/简单实用的代码收集网站,强力推荐。比如你要找个DES加密,要找个数据压缩,找个INI文件操作的C代码等,均能手到擒来。http://www.codase.com/index.html它是一个代
2014-04-30 20:00:06 749
转载 linux下C++编程
就C++开发工具而言,与Windows下微软(VC, VS2005等)一统天下相比,Linux/Unix下C++开发,可谓五花八门,各式各样。Emacs, vi, eclipse, anjuta,kdevelop等层出不穷。 Windows下,开发工具多以集成开发环境IDE的形式展现给最终用户。例如,VS2005集成了编辑器,宏汇编ml,C /C++编译器cl,资源编译器
2014-04-30 19:30:26 828
原创 看C++Primer问题集合
1.int month=09编译错误?解释: 0开头表示八进制 0x表示十六进制测试代码:#includeusing namespace std;void main(){ int month =9,day=7; int month1 =06,day1=017; cout << month << " "<< day1<<endl;}测试结果:
2014-03-26 00:43:33 891
原创 成为一个优秀的人
今天听了摩根士丹利的宣讲会,发现自己跟优秀还有很大的gap,coding ability,一般;english skills,差劲;感触还挺多的,在这个充满竞争的社会中,从普通人当中脱离出来的也只是少部分!以前总是想去到一个外企工作,但是随着时间的推移,这个目标逐渐在脑子里消散,似乎并不是我的目标了,而今天摩根士丹利有激起了申请外企公司的欲望。马上就要进入社会了,有点儿新奇,同时对未知也有一些恐惧
2014-03-25 23:42:38 953 3
原创 走上技术的道路
看过很多牛人的博客,也想过要自己去写博客,但是总是觉得自己的技术没有任何优势,也没有看什么高端的算法,没什么值得去说的。今天去华为机试发现自己的编程能力真是弱爆了,觉得自己离技术很远很远。三年大学并没有让我成为一个技术牛人,等到真正去面试笔试才发现自己学习的东西真是太少太少。于是立志奋发图强,关注各种技能提升的书,去学习技术,去理解技术!大一学过C++,这是我接触编程的第一门语言,也是我最终想找到
2014-03-25 00:07:46 949
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人