码迷,mamicode.com
首页 >  
搜索关键字:lintcode    ( 1584个结果
LintCode "Binary Representation"
Not hard to think of a solution. But the key is all details.class Solution {public: /** *@param n: Given a decimal number that is passed in as ...
分类:其他好文   时间:2015-10-04 12:20:18    阅读次数:257
LintCode "Coins in a Line"
Recursion + Memorized Search(DP). And apparently, the code below can be iterative with only 3 vars - DP.class Solution { unordered_map cache;public...
分类:其他好文   时间:2015-10-03 13:12:54    阅读次数:169
LintCode "Word Break"
LeetCode AC code failed last case with TLE. We need further pruning - we only enumerate all possible lengths of all dict words.class Solution { vec...
分类:其他好文   时间:2015-10-03 07:20:37    阅读次数:191
LintCode "Max Tree"
Something new I learnt from it: what is Treap and a O(n) constructionhttps://en.wikipedia.org/wiki/Cartesian_tree#Efficient_constructionclass Solution...
分类:其他好文   时间:2015-10-03 07:19:15    阅读次数:314
LintCode "Continuous Subarray Sum II"
Flip over your mind: in rotated subarray case, we can simply cut the continuous smallest subarray.class Solution {public: /** * @param A an int...
分类:其他好文   时间:2015-10-02 01:26:38    阅读次数:248
LintCode "Interleaving Positive and Negative Numbers"
Partition and swapping. A lot details to take care.class Solution {public: /** * @param A: An integer array. * @return: void */ void...
分类:其他好文   时间:2015-10-01 16:30:24    阅读次数:157
LintCode "Count of Smaller Number"
Fenwick Tree is perfect for this problem, though space complexity is not quite efficient.class Solution { ////////////////// // Fenwick Tree // ...
分类:其他好文   时间:2015-10-01 11:32:57    阅读次数:147
LintCode "Binary Tree Serialization"
Here is a BFS solution which is compatible with LeetCode binary tree format.class Solution {public: /** * This method will be invoked first, yo...
分类:其他好文   时间:2015-09-30 14:28:54    阅读次数:176
LintCode "Route Between Two Nodes in Graph"
DFS ended up with TLE. Only BFS works./** * Definition for Directed graph. * struct DirectedGraphNode { * int label; * vector neighbors; * ...
分类:其他好文   时间:2015-09-24 07:04:31    阅读次数:188
LintCode "Submatrix Sum"
Naive solution is O(n^4). But on 1 certain dimension, naive O(n^2) can be O(n) by this well-known equation: sum[i..j] = sum[0..j] - sum[0..i]. And pls...
分类:其他好文   时间:2015-09-23 06:47:14    阅读次数:224
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!