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
最长回文子串(Manacher算法)
题目来自
lintcode
,链接:http://www.
lintcode
.com/zh-cn/problem/longest-palindromic-substring/最长回文子串 给出一个字符串(假设长度最长为
小眼儿
·
2015-12-09 19:00
LintCode
比较字符串
比较两个字符串A和B,确定A中是否包含B中所有的字符。字符串A和B中的字符都是 大写字母样例给出A= "ABCD" B= "ACD",返回 true给出A= "ABCD" B= "AABC",返回 false注意在A中出现的B字符串里的字符不需要连续或者有序。publicclassSolution{ /** *@paramA:AstringincludesUpperCaseletters *@pa
fk5431
·
2015-12-09 17:00
String
lintcode
lintcode
Permutation Index
题目:http://www.
lintcode
.com/zh-cn/problem/permutation-index/排列序号给出一个不含重复数字的排列,求这些数字的所有排列按字典序排序后该排列的编号
小眼儿
·
2015-12-04 18:00
LintCode
更新二进制位
LintCode
更新二进制位给出两个32位的整数N和M,以及两个二进制位的位置i和j。
lbf8023
·
2015-12-03 21:06
Lintcode
Android actrivityrealut
publicclassConstants{ publicstaticfinalStringKey="key"; publicstaticfinalStringKeyB="key"; publicstaticfina
lintCode
qq_32521313
·
2015-11-30 09:00
android
LintCode
_两个整数相除
问题描述:将两个整数相除,要求不使用乘法、除法和mod运算符。如果溢出,返回2147483647。样例:给定被除数=100,除数=9,返回11。算法思想:方法一:(这是开始自己想出来的,算法思想简单,缺点是,循环次数多,运行速度慢)如果不能采用乘除运算方法,那么可以采用加减方式,当然还要(1)、注意分类:正正,正负,负正,负负;(2)、溢出问题;publicstaticintdivide(intd
Tina_yaoyao
·
2015-11-27 15:16
学习日志
LintCode
:最小差
给定两个整数数组(第一个是数组A,第二个是数组B),在数组A中取A[i],数组B中取B[j],A[i]和B[j]两者的差越小越好(|A[i]-B[j]|)。返回最小差。您在真实的面试中是否遇到过这个题?Yes样例给定数组A=[3,4,6,7],B=[2,3,8,9],返回0。挑战时间复杂度O(nlogn)标签Expand解题思路:双指针,分别指向2个数组。publicclassSolution{/
cumt_cx
·
2015-11-24 23:56
LintCode
:最大子数组差
给定一个整数数组,找出两个不重叠的子数组A和B,使两个子数组和的差的绝对值|SUM(A)-SUM(B)|最大。返回这个最大的差值。您在真实的面试中是否遇到过这个题?Yes样例给出数组[1,2,-3,1],返回6注意子数组最少包含一个数挑战时间复杂度为O(n),空间复杂度为O(n)标签Expand相关题目Expand解题思路:先从左往右求出数组的第i位的最大子数组和maxleft[]以及最小子数组和
cumt_cx
·
2015-11-24 23:41
LintCode
:最大子数组 II
给定一个整数数组,找出两个不重叠子数组使得它们的和最大。每个子数组的数字在数组中的位置应该是连续的。返回最大的和。您在真实的面试中是否遇到过这个题?Yes样例给出数组[1,3,-1,2,-1,2],这两个子数组分别为[1,3]和[2,-1,2]或者[1,3,-1,2]和[2],它们的最大和都是7注意子数组最少包含一个数挑战要求时间复杂度为O(n)Expand相关题目Expand解题思路:先左边遍历
cumt_cx
·
2015-11-24 23:42
LintCode
:最多有多少个点在一条直线上
给出二维平面上的n个点,求最多有多少点在同一条直线上。您在真实的面试中是否遇到过这个题?Yes样例给出4个点:(1,2),(3,6),(0,0),(1,3)。一条直线上的点最多有3个。标签Expand解题思路:O(n^2)的时间复杂度,利用2点求斜率,map保存斜率。需要注意的是2点元素相等和斜率不存在的情况/***Definitionforapoint.*classPoint{*intx;*in
cumt_cx
·
2015-11-24 23:17
LintCode
:更新二进制位
给出两个32位的整数N和M,以及两个二进制位的位置i和j。写一个方法来使得N中的第i到j位等于M(M会是N中从第i为开始到第j位的子串)您在真实的面试中是否遇到过这个题?Yes样例给出N=(10000000000)2,M=(10101)2,i=2,j=6返回N=(10001010100)2挑战最少的操作次数是多少?标签Expand相关题目Expand解题思路:首先将N的第i到j位清0,然后将M
cumt_cx
·
2015-11-24 23:34
LintCode
:搜索旋转排序数组 II
跟进“搜索旋转排序数组”,假如有重复元素又将如何?是否会影响运行时间复杂度?如何影响?为何会影响?写出一个函数判断给定的目标值是否出现在数组中。您在真实的面试中是否遇到过这个题?Yes样例给出[3,4,4,5,7,0,1,2]和target=4,返回true标签Expand解题思路:会有影响的,http://www.code123.cc/docs/leetcode-notes/binary_sea
cumt_cx
·
2015-11-24 22:24
lintCode
刷题--最长上升连续子序列
题目:最长上升连续子序列27%通过给定一个整数数组(下标从0到n-1,n表示整个数组的规模),请找出该数组中的最长上升连续子序列。(最长上升连续子序列可以定义为从右到左或从左到右的序列。)您在真实的面试中是否遇到过这个题?Yes样例给定[5,4,2,1,3],其最长上升连续子序列(LICS)为[5,4,2,1],返回4.给定[5,1,2,3,4],其最长上升连续子序列(LICS)为[1,2,3,4
cyclvhe
·
2015-11-24 17:01
JAVA
数据结构
算法
lintcode
刷题--比较字符串
解答:hash[256]:记录A中字母出现的次数遍历B串,将hash表中的对应位置计数器-1。值为负,返回false,结束最后,返回true代码:publicclassSolution{/***@paramA:AstringincludesUpperCaseletters*@paramB:AstringincludesUpperCaseletter*@return:ifstringAcontain
cyclvhe
·
2015-11-24 14:12
JAVA
数据结构
算法
LintCode
475 [Binary Tree Maximum Path Sum II]
原题已知一颗二叉树,找到从根节点到任意节点的最大路径和已知下面一颗二叉树1/\23返回4.(1->3)解题思路DivideandConquer借助一个helper函数,从根节点向下分裂,每一层返回左右儿子中的最大值与当前节点的值,层层递归完整代码"""DefinitionofTreeNode:classTreeNode:def__init__(self,val):this.val=valthis.
Jason_Yuan
·
2015-11-20 15:28
[
LintCode
] Expression Evaluation
Theideaisstraightforward,byusingtwostacks,wesolvethisquestionwithO(n)timeandO(n)memory.Note:givingeachoperatora“rank”makesproblemeasiertobesolved!!^o^classSolution{ public: /***@paramexpression:avecto
u012175043
·
2015-11-13 15:00
lintcode
Lintcode
:Longest Common Subsequence 解题报告
Longest Common Subsequence 原题链接:http://
lintcode
.com/zh-cn/problem/longest-common-subsequence/ Given
·
2015-11-13 05:13
sequence
Lintcode
: Longest Common Substring 解题报告
Longest Common Substring 原题链接: http://
lintcode
.com/zh-cn/problem/longest-common-substring/# Given
·
2015-11-13 05:12
substring
Lintcode
: Majority Number II 解题报告
Majority Number II 原题链接: http://
lintcode
.com/en/problem/majority-number-ii/# Given an array of integers
·
2015-11-13 05:10
number
Lintcode
: Interleaving Positive and Negative Numbers 解题报告
Interleaving Positive and Negative Numbers 原题链接 : http://
lintcode
.com/zh-cn/problem/interleaving-positive-and-negative-numbers
·
2015-11-13 05:09
number
Lintcode
: Implement Queue by Stacks 解题报告
Implement Queue by Stacks 原题链接 : http://
lintcode
.com/zh-cn/problem/implement-queue-by-stacks/# As
·
2015-11-13 05:08
Queue
Lintcode
: Majority Number 解题报告
Majority Number 原题链接:http://
lintcode
.com/en/problem/majority-number/# Given an array of integers,
·
2015-11-13 05:07
number
Lintcode
: Fast Power 解题报告
Fast Power 原题链接:http://
lintcode
.com/en/problem/fast-power/# Calculate the an % b where a, b and
·
2015-11-13 05:06
code
Lintcode
: Subarray Sum 解题报告
Subarray Sum 原题链接:http://
lintcode
.com/zh-cn/problem/subarray-sum/# Given an integer array, find a
·
2015-11-13 05:05
array
Lintcode
: Minimum Subarray 解题报告
Minimum Subarray 原题链接: http://
lintcode
.com/zh-cn/problem/minimum-subarray/# Given an array of integers
·
2015-11-13 05:05
array
Lintcode
: Kth Largest Element 解题报告
Kth Largest Element Find K-th largest element in an array. Note You can swap elements in the array Example In array [9,3,2,4,8], the 3th largest element is 4 Challenge O(n) time,
·
2015-11-13 05:03
element
Lintcode
: First Bad Version 解题报告
First Bad Version http://
lintcode
.com/en/problem/first-bad-version The code base version is an integer
·
2015-11-13 05:02
version
Lintcode
: Minimum Adjustment Cost 解题报告
Minimum Adjustment Cost Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target. If the array before adjustment is A
·
2015-11-13 05:00
code
Lintcode
: Sort Colors II 解题报告
Sort Colors II 原题链接: http://
lintcode
.com/zh-cn/problem/sort-colors-ii/# Given an array of n 
·
2015-11-13 03:46
color
lintcode
: k Sum 解题报告
K SUM My Submissions http://www.
lintcode
.com/en/problem/k-sum/ 题目来自九章算法 13% Accepted
·
2015-11-13 00:37
code
LintCode
471 [Top K Frequent Words]
原题Givenalistofwordsandanintegerk,returnthetopkfrequentwordsinthelist.给出["yes","lint","code","yes","code","baby","you","baby","chrome","safari","lint","code","body","lint","code"]当k=3时,返回["code","lint"
Jason_Yuan
·
2015-11-12 04:31
[
LintCode
] Nuts and Bolts
Thequestionisactuallyaquicksortproblem.Thebasicideais:1st,wepicka“nut”fromnutspile.2ndwedivideboltsintotwopartsaccordingtothe“nut”;3rdwefindthematchingbolt4ththenwedivideournutsintotwoparts5thusingrec
u012175043
·
2015-11-11 16:00
lintcode
Lintcode
: Longest Common Substring
Given two strings, find the longest common substring. Return the length of it. Note The characters in substring should occur continiously in original string. This is different with subsequnce.
·
2015-11-11 07:22
substring
Lintcode
: Longest Common Subsequence
Given two strings, find the longest comment subsequence (LCS). Your code should return the length of LCS. Example For "ABCD" and "EDCA", the LCS is "A" (or D or C)
·
2015-11-11 07:21
sequence
Lintcode
: Kth largest Element
Find K-th largest element in an array. Note You can swap elements in the array Example In array [9,3,2,4,8], the 3rd largest element is 4 In array [1,2,3,4,5], the 1st largest element is 5,
·
2015-11-11 07:20
element
Lintcode
: k Sum
Given n distinct positive integers, integer k (k <= n) and a number target. Find k numbers where sum is target. Calculate how many solutions there are? Example Given [1,2,3,4], k=2, target=5
·
2015-11-11 07:19
code
Lintcode
: k Sum II
Given n unique integers, number k (1<=k<=n) and target. Find all possible k integers where their sum is target. Example Given [1,2,3,4], k=2, target=5, [1,4] and [2,3] are possible solution
·
2015-11-11 07:17
code
Lintcode
: Interleaving Positive and Negative Numbers
Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers. Note You are not necessary to keep the original order or positive integers or neg
·
2015-11-11 07:16
number
Lintcode
: Heapify && Summary: Heap
Given an integer array, heapify it into a min-heap array. For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left child of A[i] and A[i * 2 + 2] is the right child o
·
2015-11-11 07:08
code
Lintcode
: Hash Function && Summary: Modular Multiplication, Addition, Power && Summary: 长整形long
In data structure Hash, hash function is used to convert a string(or any other type) into an integer smaller than hash size and bigger or equal to zero. The objective of designing a hash function is t
·
2015-11-11 07:07
function
Lintcode
: Digit Counts
Count the number of k's between 0 and n. k can be 0 - 9. Example if n=12, in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], we have FIVE 1's (1, 10, 11, 12) 方法一: Brute Force, 0到n个数挨个算过去。最大的问题就是效率,当
·
2015-11-11 07:07
count
Lintcode
: Binary Representation
Given a (decimal - e g 3.72) number that is passed in as a string,return the binary representation that is passed in as a string.If the number can not be represented accurately in binary, print “ERRO
·
2015-11-11 07:06
binary
Lintcode
: Backpack II
Given n items with size A[i] and value V[i], and a backpack with size m. What's the maximum value can you put into the backpack? Note You cannot divide item into small pieces and the total size of i
·
2015-11-11 07:05
code
Lintcode
: A+B problem
For given numbers a and b in function aplusb, return the sum of them. Note You don't need to parse the input and output. Just calculate and return. Example If a=1 and b=2 return 3 Challenge
·
2015-11-11 07:04
code
Lintcode
: Backpack
Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack? Note You can not divide any item into small pieces. Example If we have 4 items
·
2015-11-11 07:04
code
Lintcode
: Singleton && Summary: Synchronization and OOD
Singleton is a most widely used design pattern. If a class has and only has one instance at every moment, we call this design as singleton. For example, for class Mouse (not a animal mouse), we should
·
2015-11-11 01:29
Singleton
Lintcode
: Rotate String
Given a string and an offset, rotate string by offset. (rotate from left to right) Example Given "abcdefg" for offset=0, return "abcdefg" for offset=1, return "gabcd
·
2015-11-11 01:28
String
Lintcode
: Topological Sorting
Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A-->B in graph, A must before B in the order list. The first node in the order can b
·
2015-11-11 01:28
code
Lintcode
: Two Strings Are Anagrams
Write a method anagram(s,t) to decide if two strings are anagrams or not. Example Given s="abcd", t="dcab", return true O(N)time, O(1) space 1 public class Solution { 2
·
2015-11-11 01:27
String
Lintcode
: Subarray Sum
Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the last number. Example Given [-3, 1, 2, -3, 4], r
·
2015-11-11 01:24
array
上一页
73
74
75
76
77
78
79
80
下一页
按字母分类:
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
其他