码迷,mamicode.com
首页 >  
搜索关键字:pointers on c    ( 570个结果
【leetcode】Populating Next Right Pointers in Each Node
struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next...
分类:其他好文   时间:2015-04-10 01:11:13    阅读次数:117
leetcode:Populating Next Right Pointers in Each Node
一道DFS的题目,题意如下: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 1...
分类:其他好文   时间:2015-04-08 09:12:29    阅读次数:107
Leetcode: Populating Next Right Pointers in Each Node
题目: Given a binary treestruct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If there is no next right...
分类:其他好文   时间:2015-04-05 01:16:00    阅读次数:191
leetcode:Populating Next Right Pointers in Each Node
/** * Definition for binary tree with next pointer. * struct TreeLinkNode { * int val; * TreeLinkNode *left, *right, *next; * TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {...
分类:其他好文   时间:2015-04-04 09:17:58    阅读次数:124
HDU 2578 Dating with girls(1)
2都做了,把1补上。 题意给出n和k,还有n个数。就是n个数中 找出两个数x,y。使得 x+y=k。 计算所有的可能。当x0+y0=k。x1+y1=k 。 必须有不相等的。 x0!=x1 or y0!=y1。 例如 4 4 2 2 2 2 正确输出应该是 1 。 我是排序,去重,然后二分。貌似很多人都是用 two pointers。 忘了stl的二分返回下标的函数了,心情不...
分类:其他好文   时间:2015-03-30 23:11:41    阅读次数:195
Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node....
分类:其他好文   时间:2015-03-30 11:18:59    阅读次数:108
Leetcode:Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. ...
分类:其他好文   时间:2015-03-30 09:38:00    阅读次数:163
leetcode_117_Populating Next Right Pointers in Each Node II
思路: 就是用两个list存储相邻两层的结点,把第i+1层结点存储到list中的同时,分别将第i层的各个节点指向下一个,跟Populating Next Right Pointers in Each Node I一个思路。...
分类:其他好文   时间:2015-03-29 12:22:17    阅读次数:147
LeetCode – Refresh – Linked List Cycle
Just use two pointers. CC150 classical question 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNo...
分类:其他好文   时间:2015-03-20 08:06:22    阅读次数:125
LeetCode – Refresh – Intersection of Two Linked Lists
Find the common length part, then check with two pointers. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *...
分类:其他好文   时间:2015-03-20 06:57:04    阅读次数:135
570条   上一页 1 ... 35 36 37 38 39 ... 57 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!