随笔分类 -  Algorithm

上一页 1 2 3 4 5 6 7 8 ··· 14 下一页

[LintCode] Longest Increasing Continuous subsequence II
摘要:Longest Increasing Continuous subsequence IIGive you an integer matrix (with row size n, column size m),find the longest increasing continuous subsequ... 阅读全文

posted @ 2015-06-18 17:27 Eason Liu 阅读(290) 评论(0) 推荐(0)

[LintCode] Maximum Subarray Difference
摘要:Maximum Subarray DifferenceGiven an array with integers.Find twonon-overlappingsubarrays A and B, which|SUM(A) - SUM(B)|is thelargest.Return the large... 阅读全文

posted @ 2015-06-17 15:17 Eason Liu 阅读(265) 评论(0) 推荐(0)

[LintCode] Count of Smaller Number before itself
摘要:Count of Smaller Number before itselfGive you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) . For e... 阅读全文

posted @ 2015-06-14 20:24 Eason Liu 阅读(1206) 评论(0) 推荐(0)

[Google] 出现次数最多的前K个元素
摘要:bob, joe, bob, jane, bob, joe, jackbob = 3 joe = 2topN(2) = bob, joe .interface TopN { void insert(String query); List getTop(int n);}用map来存string在数... 阅读全文

posted @ 2015-06-14 19:33 Eason Liu 阅读(462) 评论(0) 推荐(0)

[LeetCode] Invert Binary Tree
摘要:Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem w... 阅读全文

posted @ 2015-06-12 15:57 Eason Liu 阅读(283) 评论(0) 推荐(0)

[LintCode] Max Tree
摘要:Max TreeGiven an integer array with no duplicates. A max tree building on this array is defined as follow:The root is the maximum number in the arrayT... 阅读全文

posted @ 2015-06-11 16:15 Eason Liu 阅读(1122) 评论(0) 推荐(0)

[LeetCode] Implement Stack using Queues
摘要:Implement Stack using QueuesImplement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the eleme... 阅读全文

posted @ 2015-06-11 11:12 Eason Liu 阅读(2100) 评论(1) 推荐(0)

[LintCode] Maximum Subarray III
摘要:Maximum Subarray IIIGiven an array of integers and a numberk, find knon-overlappingsubarrays which have the largest sum.The number in each subarray sh... 阅读全文

posted @ 2015-06-10 18:11 Eason Liu 阅读(1228) 评论(0) 推荐(0)

[LeetCode] Basic Calculator & Basic Calculator II
摘要:Basic CalculatorImplement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), t... 阅读全文

posted @ 2015-06-09 15:57 Eason Liu 阅读(4946) 评论(1) 推荐(1)

[LeetCode] Rectangle Area
摘要:Rectangle AreaFind the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right co... 阅读全文

posted @ 2015-06-08 12:30 Eason Liu 阅读(3558) 评论(1) 推荐(1)

[hihoCoder] 第四十九周: 欧拉路·一
摘要:题目1 : 欧拉路·一时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho最近在玩一个解密类的游戏,他们需要控制角色在一片原始丛林里面探险,收集道具,并找到最后的宝藏。现在他们控制的角色来到了一个很大的湖边。湖上有N个小岛(编号1..N),以及连接小岛的M座木桥。每座... 阅读全文

posted @ 2015-06-06 21:42 Eason Liu 阅读(849) 评论(0) 推荐(0)

[LeetCode] Count Complete Tree Nodes
摘要:Count Complete Tree NodesGiven acompletebinary tree, count the number of nodes.In a complete binary tree every level, except possibly the last, is com... 阅读全文

posted @ 2015-06-06 12:59 Eason Liu 阅读(2632) 评论(0) 推荐(0)

[LintCode] Minimum Adjustment Cost
摘要:Minimum Adjustment CostGiven an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given num... 阅读全文

posted @ 2015-06-03 12:55 Eason Liu 阅读(542) 评论(0) 推荐(1)

[LeetCode] Maximal Square
摘要:Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the ... 阅读全文

posted @ 2015-06-03 12:01 Eason Liu 阅读(3068) 评论(2) 推荐(0)

[LeetCode] Contains Duplicate III
摘要:Contains Duplicate IIIGiven an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennum... 阅读全文

posted @ 2015-06-01 15:33 Eason Liu 阅读(6037) 评论(0) 推荐(0)

[LintCode] Subarray Sum & Subarray Sum II
摘要:Subarray SumGiven an integer array, find a subarray where the sum of numbers iszero. Your code should return the index of the first number and the ind... 阅读全文

posted @ 2015-06-01 12:21 Eason Liu 阅读(2414) 评论(0) 推荐(0)

[hihoCoder] 第四十八周: 拓扑排序·二
摘要:题目1 : 拓扑排序·二时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho所在学校的校园网被黑客入侵并投放了病毒。这事在校内BBS上立刻引起了大家的讨论,当然小Hi和小Ho也参与到了其中。从大家各自了解的情况中,小Hi和小Ho整理得到了以下的信息:校园网主干是由N个... 阅读全文

posted @ 2015-05-30 23:20 Eason Liu 阅读(433) 评论(0) 推荐(1)

[LeetCode] Contains Duplicate & Contains Duplicate II
摘要:Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at leas... 阅读全文

posted @ 2015-05-29 13:28 Eason Liu 阅读(521) 评论(0) 推荐(0)

[剑指Offer] 滑动窗口的最大值
摘要:题目描述给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{4,4,6,6,6,5}; 针对数组{2,3,4,2,6,2,5,1}的滑动窗口有以下6个: {[2,3,4],... 阅读全文

posted @ 2015-05-29 11:36 Eason Liu 阅读(420) 评论(0) 推荐(0)

[LeetCode] The Skyline Problem
摘要:A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you aregiven... 阅读全文

posted @ 2015-05-26 16:59 Eason Liu 阅读(14707) 评论(1) 推荐(1)

上一页 1 2 3 4 5 6 7 8 ··· 14 下一页