码迷,mamicode.com
首页 >  
搜索关键字:two pointer    ( 13796个结果
A. LCIS
A. LCISTime Limit:2000msCase Time Limit:2000msMemory Limit:32768KB64-bit integer IO format:%I64d Java class name:MainGiven n integers.You have two ope...
分类:其他好文   时间:2014-07-13 23:34:39    阅读次数:272
Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from ...
分类:其他好文   时间:2014-07-13 17:21:40    阅读次数:208
Same Tree
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 and the nodes have the same value. /** * Defin...
分类:其他好文   时间:2014-07-13 15:50:25    阅读次数:158
链表操作时巧用指针的指针
比如在插入有序链表的过程中,一般情况下要使用俩指针来遍历,而后还要判断是否在第一个位置插入;利用指针的指针后不需要另外考虑这种特殊情况。 代码: #include #include struct node{ int data; struct node *next; } *head; //sorted link-list void insert(struct no...
分类:其他好文   时间:2014-07-13 15:38:13    阅读次数:198
LeetCode——Best Time to Buy and Sell Stock III
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 complete at most two transactions. Note: You ma...
分类:其他好文   时间:2014-07-13 13:55:14    阅读次数:305
[ACM] POJ 3349 Snowflake Snow Snowflakes(哈希查找,链式解决冲突)
Snowflake Snow Snowflakes Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 30512   Accepted: 8024 Description You may have heard that no two snowflakes are al...
分类:其他好文   时间:2014-07-13 13:45:20    阅读次数:235
CTCI 4.7
Design an algorithm and write code to find the first common ancestory of two nodes in a binary tree. Avoid storing additional nodes in data structure....
分类:其他好文   时间:2014-07-13 13:24:21    阅读次数:279
CTCI 4.8
You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of ...
分类:其他好文   时间:2014-07-13 13:04:00    阅读次数:186
poj 1753 Flip Game
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 29865   Accepted: 12943 Description Flip game is played on a rectangular 4x4 field with two-sided p...
分类:其他好文   时间:2014-07-12 19:15:30    阅读次数:136
HDU 1016 Prime Ring Problem 题解
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime...
分类:其他好文   时间:2014-07-12 16:42:15    阅读次数:271
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!