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... Read More
posted @ 2014-06-18 21:15 Xylophone Views(157) Comments(0) Diggs(0)
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./** * Def... Read More
posted @ 2014-06-18 20:56 Xylophone Views(116) Comments(0) Diggs(0)
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet... Read More
posted @ 2014-06-17 12:03 Xylophone Views(111) Comments(0) Diggs(0)
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this?Here are some good questions to ... Read More
posted @ 2014-06-17 10:53 Xylophone Views(215) Comments(0) Diggs(0)
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such po... Read More
posted @ 2014-06-17 08:49 Xylophone Views(669) Comments(2) Diggs(0)
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 an... Read More
posted @ 2014-06-17 01:01 Xylophone Views(110) Comments(0) Diggs(0)
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 le... Read More
posted @ 2014-06-17 00:49 Xylophone Views(141) Comments(0) Diggs(0)
C++11添加了很多新特性,可以使程序代码变得简洁,这些特性实用而且效率高。不便之处是:要增加学习成本,还有你要升级你的编译器了。目前支持C++11特性的编译器有:g++ 4.8clang 3.3intel 13.0vs2012 nov ctp目前刚接触,看看下面几个常用C++11的代码:(1)比如... Read More
posted @ 2014-06-16 23:08 Xylophone Views(446) Comments(0) Diggs(0)
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For e... Read More
posted @ 2014-06-16 00:18 Xylophone Views(151) Comments(0) Diggs(0)
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up: Can you solve it without using extra space?比... Read More
posted @ 2014-06-14 11:20 Xylophone Views(191) Comments(0) Diggs(0)