08 2015 档案

Linked List Cycle II
摘要:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Note:Do not modify the linked list.Follow up:Can you sol... 阅读全文

posted @ 2015-08-30 11:34 horizon.qiang 阅读(129) 评论(0) 推荐(0)

Linked List Cycle
摘要:Given a linked list, determine if it has a cycle in it. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ... 阅读全文

posted @ 2015-08-30 11:33 horizon.qiang 阅读(134) 评论(0) 推荐(0)

Search a 2D Matrix
摘要:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文

posted @ 2015-08-30 11:32 horizon.qiang 阅读(190) 评论(0) 推荐(0)

Climbing Stairs
摘要:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文

posted @ 2015-08-30 11:31 horizon.qiang 阅读(129) 评论(0) 推荐(0)

Path Sum
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文

posted @ 2015-08-30 11:30 horizon.qiang 阅读(149) 评论(0) 推荐(0)

Implement strStr()
摘要:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 1 class Solution { 2 publ... 阅读全文

posted @ 2015-08-30 11:29 horizon.qiang 阅读(100) 评论(0) 推荐(0)

Remove Element
摘要:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文

posted @ 2015-08-30 11:28 horizon.qiang 阅读(108) 评论(0) 推荐(0)

Intersection of Two Linked Lists
摘要:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文

posted @ 2015-08-30 11:25 horizon.qiang 阅读(135) 评论(0) 推荐(0)

Reverse Linked List
摘要:Reverse a singly linked list./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) :... 阅读全文

posted @ 2015-08-30 11:23 horizon.qiang 阅读(128) 评论(0) 推荐(0)

Remove Linked List Elements
摘要:Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文

posted @ 2015-08-30 11:21 horizon.qiang 阅读(357) 评论(0) 推荐(0)

导航