2015年11月18日

ptrdiff_t 和 size_t

摘要: size_t和ptrdiff_t常常用来指示数组长度。size_t常用于表示数组的大小,可以一般的将他看为typedefunsignedintsize_t,实质是一个无符号整形。包含在头文件“stddef.h”中。ptrdiff_t常用来保存两个指针减法的结果,常常被定义为long int类型。 阅读全文

posted @ 2015-11-18 10:17 horizon.qiang 阅读(212) 评论(0) 推荐(0) 编辑

2015年8月30日

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 阅读(113) 评论(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 阅读(125) 评论(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 阅读(183) 评论(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 阅读(122) 评论(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 阅读(137) 评论(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 阅读(87) 评论(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 阅读(100) 评论(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 阅读(125) 评论(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 阅读(121) 评论(0) 推荐(0) 编辑

导航