E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
lintCode
Lintcode
: Sort Colors II
Given an array of n objects with k different colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors in the order 1, 2, ... k. Note You are not sup
·
2015-11-11 01:23
color
Lintcode
: Single Number III
Given 2*n + 2 numbers, every numbers occurs twice except two, find them. Example Given [1,2,2,3,4,4,5,3] return 1 and 5 Challenge O(n) time, O(1) extra space. 利用bitwise XOR的特点,n个数(0或1),如果1的个
·
2015-11-11 01:23
number
Lintcode
: Search Range in Binary Search Tree
Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find all the keys of tree in range k1 to k2. i.e. print all x such that k1<=x<=k2 and x is a key of give
·
2015-11-11 01:22
Binary search
Lintcode
: Search a 2D matrix II
Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it. This matrix has the following properties: * Integers in each row are sorted from left
·
2015-11-11 01:21
search
Lintcode
: Serialization and Deserialization Of Binary Tree
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back from the file to reconstruct the exact same binary
·
2015-11-11 01:21
serialization
Lintcode
: Rehashing
The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should double the size of the hash table and rehash ever
·
2015-11-11 01:20
code
Lintcode
: Recover Rotated Sorted Array
Given a rotated sorted array, recover it to sorted array in-place. Example [4, 5, 1, 2, 3] -> [1, 2, 3, 4, 5] Challenge In-place, O(1) extra space and O(n) time. Clarification What is r
·
2015-11-11 01:19
array
Lintcode
: Product of Array Exclude Itself
Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B without divide operation. Example For A=[1, 2, 3], B is [6, 3, 2] 非常典型的Forward-Backward Trave
·
2015-11-11 01:18
exclude
Lintcode
: Partition Array
Given an array "nums" of integers and an int "k", Partition the array (i.e move the elements in "nums") such that, * All elements < k are moved to the left
·
2015-11-11 01:18
partition
Lintcode
: Previous Permuation
Given a list of integers, which denote a permutation. Find the previous permutation in ascending order. Note The list may contains duplicate integers. Example For [1,3,2,3], the previous pe
·
2015-11-11 01:17
code
Lintcode
: O(1) Check Power of 2
Using O(1) time to check whether an integer n is a power of 2. Example For n=4, return true For n=5, return false Challenge O(1) time Tags Expand 这道题考察bit manipulation. 1的个数只能有1个才是power
·
2015-11-11 01:16
check
Lintcode
: Minimum Adjustment Cost
1 Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target. 2 3 If the array before adjustment is A, the array after
·
2015-11-11 01:16
code
Lintcode
: Merge Sorted Array
Merge two given sorted integer array A and B into a new sorted integer array. Example A=[1,2,3,4] B=[2,4,5,6] return [1,2,2,3,4,4,5,6] Challenge How can you optimize your algorithm if on
·
2015-11-11 01:12
array
Lintcode
: Median
Given a unsorted array with integers, find the median of it. A median is the middle number of the array after it is sorted. If there are even numbers in the array, return the N/2-th number aft
·
2015-11-11 01:11
media
Lintcode
: Maximum Subarray III
Given an array of integers and a number k, find k non-overlapping subarrays which have the largest sum. The number in each subarray should be contiguous. Return the largest sum. Note The sub
·
2015-11-11 01:10
array
Lintcode
: Maximum Subarray II
Given an array of integers, find two non-overlapping subarrays which have the largest sum. The number in each subarray should be contiguous. Return the largest sum. Note The subarray should
·
2015-11-11 01:08
array
Lintcode
: Maximum Subarray Difference
Given an array with integers. Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest. Return the largest difference. Note The subarray should contain at least one
·
2015-11-11 01:07
array
Lintcode
: Majority Number II
Given an array of integers, the majority number is the number that occurs more than 1/3 of the size of the array. Find it. Note There is only one majority number in the array Example For [1
·
2015-11-11 01:06
number
Lintcode
: Lowest Common Ancestor
Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes. The lowest common ancestor is the node with largest depth which is the ancestor of both nodes.
·
2015-11-11 01:06
code
[
LintCode
]Maximum Subarray Difference
SolvingthisquestionbyO(n)timew/O(n)space.Thebasicideaistofindaappropriatecutletthedifferencebecomelargest.Wekeeptracklocalmax,localmin,leftmax,leftmin,andrightmin,rightmax.classSolution{ public: /***@
u012175043
·
2015-11-10 17:00
lintcode
[
LintCode
] Convert Expression to Polish Notation
Thebasicideaisusingastacktostoreeveryoperator.Forparentheses,ifwemeet“)”weadditintostack.ifwemeet”(”wepopstacktillwemeet“)”.classSolution{ public: /***@paramexpression:Astringarray*@return:ThePolishno
u012175043
·
2015-11-10 17:00
lintcode
[
LintCode
] Longest Increasing Continuous subsequence II
http://www.
lintcode
.com/en/problem/longest-increasing-continuous-subsequence-ii/# Give you an integer
·
2015-11-09 14:51
sequence
[
LintCode
] Longest Increasing Continuous subsequence
http://www.
lintcode
.com/en/problem/longest-increasing-continuous-subsequence/# Give you an integer
·
2015-11-09 14:51
sequence
[
LintCode
] Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1].
·
2015-11-09 14:50
code
[
LintCode
] 拓扑排序
http://www.
lintcode
.com/zh-cn/problem/topological-sorting/# 给定一个有向图,图节点的拓扑排序被定义为: 对于每条有向边A
·
2015-11-09 14:49
code
[
LintCode
] Permutations
http://www.
lintcode
.com/en/problem/permutations/# Given a list of numbers, return all possible permutations
·
2015-11-09 14:49
code
[LeetCode 127] Word Ladder
https://leetcode.com/problems/word-ladder/ http://www.
lintcode
.com/zh-cn/problem/word-ladder/
·
2015-11-09 14:45
LeetCode
[LeetCode] word ladder II
http://www.
lintcode
.com/zh-cn/problem/word-ladder-ii/# 给出两个单词(start和end)和一个字典,找出所有从start到end的最短转换序列
·
2015-11-09 14:45
LeetCode
[LeetCode 107] Binary Tree Level Order Traversal II
https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ http://www.
lintcode
.com/zh-cn
·
2015-11-09 14:40
LeetCode
[LeetCode 102] Binary Tree Level Order Traversal
https://leetcode.com/problems/binary-tree-level-order-traversal/ http://www.
lintcode
.com/zh-cn/problem
·
2015-11-09 14:39
LeetCode
[
LintCode
] Continuous Subarray Sum II
ActuallythequestionislikeContinuousSubarraysum,butnowthearraybecomesacirculararray!!Hereisagreatexplanation:http://www.geeksforgeeks.org/maximum-contiguous-circular-sum/Sotherearetwopossibleanswerstot
u012175043
·
2015-11-09 11:00
lintcode
[
LintCode
] Continuous Subarray Sum
Givenanintegerarray,findacontinuoussubarraywherethesumofnumbersisthebiggest.Yourcodeshouldreturntheindexofthefirstnumberandtheindexofthelastnumber.(Iftheirareduplicateanswer,returnanyone)Forthisproble
u012175043
·
2015-11-09 10:00
lintcode
[
LintCode
] Coins in a line II
Note:Bothplayerareintelligent.dp[i]indicatesthemaximumvaluewecangetfrompositionitotheendofcoins.Therearetwochoices:1st:Wetakeonlyonecoinswhichhasvalues[i],thentheotherplayerwillgiveusachoicesbetweenmi
u012175043
·
2015-11-09 08:00
dp
lintcode
Lintcode
: Sort Letters by Case
Given a string which contains only letters. Sort it by lower case first and upper case second. Note It's not necessary to keep the original order of lower-case letters and upper case letters. E
·
2015-11-08 17:08
code
Lintcode
: Nth to Last Node in List
Find the nth to last element of a singly linked list. The minimum number of nodes in list is n. Example Given a List 3->2->1->5->null and n = 2, return node whose value is 1. R
·
2015-11-08 17:07
list
Lintcode
: Insert Node in a Binary Search Tree
Given a binary search tree and a new tree node, insert the node into the tree. You should keep the tree still be a valid binary search tree. Example Given binary search tree as follow: 2
·
2015-11-08 17:06
Binary search
Lintcode
: Kth Prime Number
Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7. The eligible numbers are like 3, 5, 7, 9, 15 ... Example If k=4, return 9. Challenge O(n log n)
·
2015-11-08 17:06
number
Lintcode
: Implement Queue by Stacks
As the title described, you should only use two stacks to implement a queue's actions. The queue should support push(element), pop() and top() where pop is pop the first(a.k.a front) element in the
·
2015-11-08 17:04
Queue
Lintcode
: Fizz Buzz
Given number n. Print number from 1 to n. But: when number is divided by 3, print fizz; when number is divided by 5, print buzz; when number is divided by both 3 and 5, print fizz buzz. Ex
·
2015-11-08 17:04
code
Lintcode
: First Bad Version
The code base version is an integer and start from 1 to n. One day, someone commit a bad version in the code case, so it caused itself and the following versions are all failed in the unit tests. You
·
2015-11-08 17:03
version
Lintcode
: Find a Peak
There is an integer array which has the following features: * The numbers in adjacent positions are different. * A[0] < A[1] && A[A.length - 2] > A[A.length - 1]. We def
·
2015-11-08 17:03
code
Lintcode
: Fast Power
Calculate the a^n % b where a, b and n are all 32bit integers. Example For 2^31 % 3 = 2 For 100^1000 % 1000 = 0 Challenge O(logn) 这道题跟Pow这道题很像 数学问题,要求O(log n)的时间复杂度,也就是每次去掉一半的计算量,先要找到对应的
·
2015-11-08 17:02
code
Lintcode
: Compare Strings
Compare two strings A and B, determine whether A contains all of the characters in B. The characters in string A and B are all Upper Case letters. Example For A = "ABCD", B = "AB
·
2015-11-08 17:01
compare
Lintcode
: Delete Digits
Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to the original order to become a new positive integ
·
2015-11-08 17:01
delete
Lintcode
: Binary Search
Binary search is a famous question in algorithm. For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity. If the target nu
·
2015-11-08 17:00
Binary search
[
lintcode
]Majority Number III
http://
lintcode
.com/en/problem/majority-number-iii/ 此题是黑帮火并的思想,就是如果有k个不同的元素,那么把他们全去掉,不影响剩下的元素中的“众数”。
·
2015-11-08 13:50
number
LintCode
字符串比较
比较两个字符串A和B,确定A中是否包含B中所有的字符。字符串A和B中的字符都是大写字母: 给出 A = "ABCD" B = "AABC", 返回 false 给出 A = "ABCD" B = "ACD",返回 true 我的代码: /** * 由于是在字
·
2015-11-07 14:06
code
lintcode
- 乘积最大子序列
找出一个序列中乘积最大的连续子序列(至少包含一个数)。您在真实的面试中是否遇到过这个题?样例比如,序列 [2,3,-2,4] 中乘积最大的子序列为 [2,3] ,其乘积为6classSolution{ public: intmaxProduct(vector&nums){ intposMax=nums[0]; intnegMax=nums[0]; intret=nums[0]; for(int
ljlstart
·
2015-11-06 23:00
LintCode
-- 最大子数组 III
LintCode
--maximum-subarray-iii(最大子数组III)原题链接:http://www.
lintcode
.com/zh-cn/problem/maximum-subarray-iii
chan15
·
2015-11-01 22:00
算法
lintcode
O(1) Check Power of 2 -
LintCode
examination questions Using O(1) time to check whether an integer n is a power of 2. Example For n=4, return true; For n=5, return false; Challenge O(1) time 解题代码 class Solution { publ
·
2015-10-31 11:01
check
上一页
74
75
76
77
78
79
80
81
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他