码迷,mamicode.com
首页 >  
搜索关键字:two pointer    ( 13796个结果
Two Sum leetcode java
题目:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the tw....
分类:编程语言   时间:2014-07-22 22:47:33    阅读次数:256
Codeforces #256 Div.2
B. Suffix Structure 1. 先判断s去掉一些元素是否能构成t,如果可以就是automaton 判断的方法也很简单,two pointer,相同元素同时++,不相同s的指针++,如果t能全找到,那么s能够去掉元素构成t。 bool f(string s, string t) { in...
分类:其他好文   时间:2014-07-22 22:44:54    阅读次数:139
【leetcode刷题笔记】Add Binary
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".题解:简单的二进制加法模拟。a,b的最后以为对齐开始进行加法,用carries保存进位,如果加...
分类:其他好文   时间:2014-07-22 22:42:32    阅读次数:196
【leetcode刷题笔记】Edit Distance
Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol...
分类:其他好文   时间:2014-07-22 22:37:33    阅读次数:191
Python ctypes中cast/py_object用法
class ctypes.py_objectRepresents the C PyObject * datatype. Calling this without an argument creates a NULL PyObject * pointer.示例:>>> dc = {'a':'aaa',...
分类:编程语言   时间:2014-07-22 00:28:38    阅读次数:373
POJ 1845 Sumdiv
Sumdiv Description Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line...
分类:其他好文   时间:2014-07-21 16:27:12    阅读次数:187
LeetCode: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 an...
分类:其他好文   时间:2014-07-21 14:35:26    阅读次数:206
从键盘上输入两个数,按小大的顺序输出
#include #include int main() {    int num1,num2;    int *num1_p=&num1,*num2_p=&num2,*pointer;    printf("Input the first number:");    scanf("%d",num1_p);    printf("Input the second num...
分类:其他好文   时间:2014-07-21 11:14:14    阅读次数:180
LeetCode "Merge Two Sorted Lists"
Simply care about the boundary cases:class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { if (l1 && !l2) return l1;...
分类:其他好文   时间:2014-07-21 11:07:04    阅读次数:206
【LeetCode】【Python题解】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. 比较两个...
分类:编程语言   时间:2014-07-20 22:12:03    阅读次数:273
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!