摘要: Linked List CycleGiven a linked list, determine if it has a cycle in it.c++/** * Definition for singly-linked list. * struct ListNode { * int val;... 阅读全文
posted @ 2014-10-19 22:04 zlz~ling 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.c++版:class Solution {public: int singleNumbe... 阅读全文
posted @ 2014-10-19 21:20 zlz~ling 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文
posted @ 2014-10-19 21:16 zlz~ling 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Max Points on a LineGivennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.c++版本:/** * Definition for a poi... 阅读全文
posted @ 2014-10-19 21:12 zlz~ling 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Evaluate Reverse Polish NotationValid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", ... 阅读全文
posted @ 2014-10-19 21:10 zlz~ling 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".c++版:... 阅读全文
posted @ 2014-10-19 21:00 zlz~ling 阅读(127) 评论(0) 推荐(0) 编辑