码迷,mamicode.com
首页 >  
搜索关键字:two pointers    ( 12138个结果
Divide Two Integers
Divide two integers without using multiplication, division and mod operator. public class Solution { public int divide(int dividend, int divisor) { int sign = 1; if (dividend < 0) { ...
分类:其他好文   时间:2014-05-15 14:40:50    阅读次数:285
LeetCode-004 Add Two Numbers
【题目】 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Out...
分类:其他好文   时间:2014-05-15 05:13:49    阅读次数:306
leetcode -day14 Populating Next Right Pointers in Each Node I II
1、 ?? Populating Next Right Pointers in Each Node Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate...
分类:其他好文   时间:2014-05-15 04:57:36    阅读次数:221
leetCode-002 Median of Two Sorted Arrays
leetCode-002 Median of Two Sorted Arrays 【题目】 There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 【题意】 有两个有序的数组,找出这两数组整合后的中位数,要求时间复杂度O(nlogn)...
分类:其他好文   时间:2014-05-15 04:42:05    阅读次数:274
LeetCode-001 Two Sum
LeetCode-001 Two Sum 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 two numbers such that they add up to the target, where index1 must be less than index2...
分类:其他好文   时间:2014-05-15 04:34:50    阅读次数:293
LeetCode--Same Tree
Same Tree  Total Accepted: 16072 Total Submissions: 38790My Submissions Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal i...
分类:其他好文   时间:2014-05-15 04:00:39    阅读次数:319
Leetcode 线性表 Two Sum
题意:给定一组数和另一个数,在这组数中找两个数,使它们的和等于给定的数 思路1: --> 错,因为题目要求返回下标。 1.排序 2.两个下标,一个指向头,一个指向尾 3.如果下标指向的两个元素相加大于给定的数,尾下标减一 如果小于,头下标加一 思路2: hash 1.用hash存储每个数的下标 2.数组,看hash[target-num[i]]是否存在 复杂度:时间O(n), 空间O(n)...
分类:其他好文   时间:2014-05-15 01:28:13    阅读次数:297
Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:其他好文   时间:2014-05-14 23:11:14    阅读次数:398
android
An intent service is similar to regular service, with two main exceptions: whatever work is to be done in onHandleIntent() will execute on a separate ...
分类:移动开发   时间:2014-05-14 22:53:39    阅读次数:395
Linux 高性能服务器编程——高级I/O函数
重定向dup和dup2函数[cpp] view plaincopyprint?#includeintdup(intfile_descriptor);intdup2(intfile_descriptor_one,intfile_descriptor_two);dup创建一个新的文件描述符, 此描述符和...
分类:系统相关   时间:2014-05-14 22:34:09    阅读次数:479
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!