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 ...
分类:
其他好文 时间:
2014-10-02 02:34:02
阅读次数:
227
Divide two integers without using multiplication, division and mod operator.方法一:暴力破解,不断用被除数减去除数,直至出现负数停止,铁定超时。方法二:对方法一的改进,每次寻找 满足2k-1 * 除数 0 && diviso...
分类:
其他好文 时间:
2014-10-02 01:55:51
阅读次数:
271
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity1. Naive Solution思路:直接的想法依次找出列表中的最小项串接起来。 复杂度分析:时间复杂度...
分类:
其他好文 时间:
2014-10-02 01:18:11
阅读次数:
163
从给定的有序链表生成一颗平衡二叉树。
解题思路:最容易想到的就是利用数组生成二叉树的方法,找到中间节点作为二叉树的root节点,然后分别对左右链表递归调用分别生成左子树和右子树。时间复杂度O(N*lgN)...
分类:
其他好文 时间:
2014-10-01 23:36:31
阅读次数:
243
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:
其他好文 时间:
2014-10-01 19:08:51
阅读次数:
163
Upon a homely object Love can wink.—William Shakespeare, The Two Gentlemen of VeronaThe simple types of JavaScript are numbers, strings, booleans (tru...
分类:
编程语言 时间:
2014-10-01 15:31:31
阅读次数:
351
——转载:一、概述: Sorted-Sets和Sets类型极为相似,它们都是字符串的集合,都不允许重复的成员出现在一个Set中。它们之间的主要差别是Sorted-Sets中的每一个成员都会有一个分数(score)与之关联,Redis正是通过分数来为集合中的成员进行从小到大的排序。然而需要额外指出的是...
分类:
其他好文 时间:
2014-10-01 14:21:01
阅读次数:
215
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2014-10-01 13:46:11
阅读次数:
190
N-Queens
Total Accepted: 15603 Total
Submissions: 60198My Submissions
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other...
分类:
其他好文 时间:
2014-10-01 12:42:01
阅读次数:
139
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.方法一:暴力破解,1和2合并,合并后再和3合并,合并后再和4合并。。。如此下去一直将所有链表节点全部合并完。...
分类:
其他好文 时间:
2014-10-01 12:19:11
阅读次数:
252