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
] Wiggle Sort II 扭动排序之二
Givenanunsortedarraynums,reorderitsuchthatnums[0]nums[2]&nums){ vectort=nums; intn=nums.size(),k=(n+1)/2,j=n; sort(t.begin(),t.end()); for(inti=0;i&nums){ #defineA(i)nums[(1+i*2)%(n|1)] intn=nu
Grandyang
·
2016-05-17 13:00
[
LintCode
/LeetCode] Median of two Sorted Arrays
ProblemTherearetwosortedarraysAandBofsizemandnrespectively.Findthemedianofthetwosortedarrays.ExampleGivenA=[1,2,3,4,5,6]andB=[2,3,4,5],themedianis3.5.GivenA=[1,2,3]andB=[4,5],themedianis3.ChallengeThe
linspiration
·
2016-05-17 00:00
divide-conquer
binary-search
java
[
LintCode
] Wiggle Sort 扭动排序
Givenanunsortedarraynums,reorderitin-placesuchthatnums[0]=nums[2]&nums){ sort(nums.begin(),nums.end()); for(inti=1;i&nums){ for(inti=1;inums[i-1])){ swap(nums[i],nums[i-1]); } } } };
Grandyang
·
2016-05-16 23:00
[
LintCode
] Maximal Rectangle 最大矩形
Givena2DbooleanmatrixfilledwithFalseandTrue,findthelargestrectanglecontainingallTrueandreturnitsarea.ExampleGivenamatrix:[[1,1,0,0,1],[0,1,0,0,1],[0,0,1,1,1],[0,0,1,1,1],[0,0,0,0,1]]return6. LeetCode
Grandyang
·
2016-05-15 23:00
[
LintCode
] Swap Two Nodes in Linked List 交换链表中的两个结点
Givenalinkedlistandtwovaluesv1andv2.Swapthetwonodesinthelinkedlistwithvaluesv1andv2.It'sguaranteedthereisnoduplicatevaluesinthelinkedlist.Ifv1orv2doesnotexistinthegivenlinkedlist,donothing.NoticeYous
Grandyang
·
2016-05-14 23:00
LintCode
-最大数
package
LintCode
; importjava.util.Arrays; importjava.util.Comparator; publi
fk5431
·
2016-05-13 22:00
lintcode
LintCode
加油站
在一条环路上有 N 个加油站,其中第 i 个加油站有汽油gas[i],并且从第_i_个加油站前往第_i_+1个加油站需要消耗汽油cost[i]。你有一辆油箱容量无限大的汽车,现在要从某一个加油站出发绕环路一周,一开始油箱为空。求可环绕环路一周时出发的加油站的编号,若不存在环绕一周的方案,则返回-1。 注意事项数据保证答案唯一。您在真实的面试中是否遇到过这个题? Yes样例现在有4个加油站,汽油量g
fk5431
·
2016-05-13 21:00
Class
lintcode
LintCode
主元素
给定一个整型数组,找出主元素,它在数组中的出现次数严格大于数组元素个数的二分之一。您在真实的面试中是否遇到过这个题? Yes样例给出数组[1,1,1,1,2,2,2],返回1publicclassSolution{ /** *@paramnums:alistofintegers *@return:findamajoritynumber */ publicintmajorityNumber(Arra
fk5431
·
2016-05-13 21:00
面试
lintcode
LintCode
落单的数
1,2,2,1,3,4,3],返回4挑战 一次遍历,常数级的额外空间复杂度***********************************************************异或package
LintCode
fk5431
·
2016-05-13 21:00
lintcode
LintCode
二进制表示
给定一个数将其转换为二进制(均用字符串表示),如果这个数的小数部分不能在32个字符之内来精确地表示,则返回 "ERROR"。您在真实的面试中是否遇到过这个题? Yes样例n= "3.72",返回 "ERROR".n= "3.5",返回 "11.1".***************************************************************************
fk5431
·
2016-05-13 20:00
二进制
lintcode
LintCode
:乱序字符串
LintCode
:乱序字符串PythonclassSolution: #@paramstrs:Alistofstrings #@return:Alistofstrings defanagrams(self
u012225151
·
2016-05-13 17:00
LintCode
:带最小值操作的栈
LintCode
:带最小值操作的栈PythonclassMinStack(object): def__init__(self): #dosomeintializeifnecessary self.stack
u012225151
·
2016-05-13 16:00
LintCode
:用栈实现队列
LintCode
:用栈实现队列PythonclassMyQueue: def__init__(self): self.stack1=[] self.stack2=[] defpush(self,element
u012225151
·
2016-05-13 14:00
LintCode
:二叉树的层次遍历 II
LintCode
:二叉树的层次遍历II"""DefinitionofTreeNode:classTreeNode:def__init__(self,val):self.val=valself.left,
u012225151
·
2016-05-13 13:00
LintCode
:重哈希
LintCode
:重哈希"""DefinitionofListNodeclassListNode(object):def__init__(self,val,next=None):self.val=valself.next
u012225151
·
2016-05-12 20:00
LintCode
:主元素 III
LintCode
:主元素IIIPythonclassSolution: """@paramnums:Alistofintegers@paramk:Asdescribed@return:Themajoritynumber
u012225151
·
2016-05-12 19:00
LintCode
:子数组之和
LintCode
:子数组之和方法一:O(n^2)复杂度:PythonclassSolution: """@paramnums:Alistofintegers@return:Alistofintegersincludestheindexofthefirstnumberandtheindexofthelastnumber
u012225151
·
2016-05-12 19:00
LintCode
: 三数之和
LintCode
:三数之和classSolution: """@paramnumbersbers:Giveanarraynumbersbersofninteger@return:Findalluniquetripletsinthearraywhichgivesthesumofzero
u012225151
·
2016-05-12 17:00
LintCode
:图中两个点之间的路线
LintCode
:图中两个点之间的路线Python方法一:#DefinitionforaDirectedgraphnode #classDirectedGraphNode: #def__init__(self
u012225151
·
2016-05-12 14:00
LintCode
:丢失的第一个正整数
LintCode
:丢失的第一个正整数Pythonfromtimeimportsleep classSolution: #@paramA,alistofintegers #@returnaninteger
u012225151
·
2016-05-12 12:00
LintCode
:旋转字符串
LintCode
:旋转字符串PythonclassSolution: #@params:alistofchar #@paramoffset:aninteger #@return:nothing defrotateString
u012225151
·
2016-05-12 00:00
LintCode
:最长上升子序列
LintCode
:最长上升子序列LIS转化为LCS问题,动态规划。
u012225151
·
2016-05-11 21:00
动态规划
LintCode
:线段树的查询
LintCode
:线段树的查询"""DefinitionofSegmentTreeNode:classSegmentTreeNode:def__init__(self,start,end,max):self.start
u012225151
·
2016-05-11 20:00
LintCode
:二叉树的层次遍历
LintCode
:二叉树的层次遍历方法一:二叉树的层序遍历,需要借助两个队列空间。
u012225151
·
2016-05-11 18:00
二叉树
LintCode
:Swap Two Nodes in Linked List
LintCode
:SwapTwoNodesinLinkedList#Definitionforsingly-linkedlist.
u012225151
·
2016-05-11 16:00
LintCode
:中位数
LintCode
:中位数PythonclassSolution: """@paramnums:Alistofintegers.
u012225151
·
2016-05-11 14:00
LintCode
:落单的数 III
LintCode
:落单的数IIIPythonclassSolution: """@paramA:Anintegerarray@return:Twointeger""" defsingleNumberIII
u012225151
·
2016-05-10 22:00
LintCode
:空格替换
LintCode
:空格替换注意事项如果使用Java或Python,程序中请用字符数组表示字符串。
u012225151
·
2016-05-10 22:00
lintcode
_单词切分
Yes样例给出s= "
lintcode
"dict= ["lint","code"]返回true因为"
lintcode
"可以被空格切分成"
lintcode
"思路过程直观的想法是直接遍历string,有匹配的单词就做一次切分
weilianyishi
·
2016-05-10 20:00
算法
面试
LintCode
81 -- 数据流中位数
题目中位数II数字是不断进入数组的,在每次添加一个新的数进入数组的同时返回当前新数组的中位数。说明中位数的定义:中位数是排序后数组的中间值,如果有数组中有n个数,则中位数为A[(n-1)/2]。比如:数组A=[1,2,3]的中位数是2,数组A=[1,19]的中位数是1。样例持续进入数组的数的列表为:[1,2,3,4,5],则返回[1,1,2,2,3]持续进入数组的数的列表为:[4,5,1,3,2,
fly_yr
·
2016-05-10 20:00
LintCode
: 矩阵归零
LintCode
:矩阵归零Python classSolution: """@parammatrix:Alistoflistsofintegers@return:Nothing""" defsetZeroes
u012225151
·
2016-05-10 19:00
python
LintCode
: 将二叉树拆成链表
LintCode
:将二叉树拆成链表Python"""DefinitionofTreeNode:classTreeNode:def__init__(self,val):this.val=valthis.left
u012225151
·
2016-05-10 19:00
二叉树
LintCode
:买卖股票的最佳时机 II
LintCode
:买卖股票的最佳时机II贪心算法,只要后一天的价格大于前一天的价格就买入。
u012225151
·
2016-05-10 18:00
算法
LintCode
:乘积最大子序列
LintCode
:乘积最大子序列动态规划,不过与和最大子序列不同,原因是乘积有正负,因而在动规数组中不能只记录最大值,还需要记录最小值,如:nums=[1,0,-1,2,3,-5,-2],如果只用一个动规数组
u012225151
·
2016-05-10 17:00
动态规划
LintCode
:x的平方根
LintCode
:x的平方根二分法PythonclassSolution: """@paramx:Aninteger@return:Thesqrtofx""" defsqrt(self,x): #writeyourcodehere
u012225151
·
2016-05-10 12:00
lintcode
_和为零的子矩阵
描述 笔记 数据 评测给定一个整数矩阵,请找出一个子矩阵,使得其数字之和等于0.输出答案时,请返回左上数字和右下数字的坐标。您在真实的面试中是否遇到过这个题? Yes样例给定矩阵[ [1,5,7], [3,7,-8], [4,-8,9], ] 返回 [(1,1),(2,2)]普通解法:使用空间换时间,四重循环用来确定子矩阵的边界,使用数组记录累积子矩阵的和,这样可以节约两重循环,时间复杂度O(n
weilianyishi
·
2016-05-09 21:00
算法
面试
LintCode
:在二叉查找树中插入节点
[
LintCode
:在二叉查找树中插入节点](http://www.
lintcode
.com/zh-cn/problem/insert-node-in-a-binary-search-tree/)Python
u012225151
·
2016-05-09 20:00
python
LintCode
:线段树的构造
LintCode
:线段树的构造"""DefinitionofSegmentTreeNode:classSegmentTreeNode:def__init__(self,start,end):self.start
u012225151
·
2016-05-09 18:00
【
LintCode
】MinStack
题目链接:http://www.
lintcode
.com/zh-cn/problem/min-stack/题目:实现一个带有取最小值min方法的栈,min方法将返回当前栈中的最小值。
yeqiuzs
·
2016-05-08 20:00
ACM
[
LintCode
] Decode Ways 解码方法
AmessagecontaininglettersfromA-Zisbeingencodedtonumbersusingthefollowingmapping:'A'->1'B'->2...'Z'->26Givenanencodedmessagecontainingdigits,determinethetotalnumberofwaystodecodeit.ExampleGivenencoded
Grandyang
·
2016-04-30 12:00
[
LintCode
] Perfect Squares 完全平方数
Givenapositiveintegern,findtheleastnumberofperfectsquarenumbers(forexample,1,4,9,16,...)whichsumton.ExampleGivenn=12,return3because12=4+4+4Givenn=13,return2because13=4+9
Grandyang
·
2016-04-30 12:00
[
LintCode
] Paint Fence 粉刷篱笆
Thereisafencewithnposts,eachpostcanbepaintedwithoneofthekcolors.Youhavetopaintallthepostssuchthatnomorethantwoadjacentfencepostshavethesamecolor.Returnthetotalnumberofwaysyoucanpaintthefence.Noticena
Grandyang
·
2016-04-30 12:00
[
LintCode
] Paint House 粉刷房子
Therearearowofnhouses,eachhousecanbepaintedwithoneofthethreecolors:red,blueorgreen.Thecostofpaintingeachhousewithacertaincolorisdifferent.Youhavetopaintallthehousessuchthatnotwoadjacenthouseshavethes
Grandyang
·
2016-04-30 12:00
[
LintCode
] Paint House II 粉刷房子之二
Therearearowofnhouses,eachhousecanbepaintedwithoneofthekcolors.Thecostofpaintingeachhousewithacertaincolorisdifferent.Youhavetopaintallthehousessuchthatnotwoadjacenthouseshavethesamecolor.Thecostofpa
Grandyang
·
2016-04-30 12:00
[
LintCode
] Ugly Number 丑陋数
Writeaprogramtocheckwhetheragivennumberisanuglynumber`.Uglynumbersarepositivenumberswhoseprimefactorsonlyinclude2,3,5.Forexample,6,8areuglywhile14isnotuglysinceitincludesanotherprimefactor7.NoticeNot
Grandyang
·
2016-04-30 12:00
[
LintCode
] House Robber II 打家劫舍之二
Afterrobbingthosehousesonthatstreet,thethiefhasfoundhimselfanewplaceforhisthieverysothathewillnotgettoomuchattention.Thistime,allhousesatthisplacearearrangedinacircle.Thatmeansthefirsthouseistheneigh
Grandyang
·
2016-04-29 12:00
[
LintCode
] House Robber 打家劫舍
Youareaprofessionalrobberplanningtorobhousesalongastreet.Eachhousehasacertainamountofmoneystashed,theonlyconstraintstoppingyoufromrobbingeachofthemisthatadjacenthouseshavesecuritysystemconnectedandit
Grandyang
·
2016-04-29 12:00
[
LintCode
] House Robber III 打家劫舍之三
Thethiefhasfoundhimselfanewplaceforhisthieveryagain.Thereisonlyoneentrancetothisarea,calledthe"root."Besidestheroot,eachhousehasoneandonlyoneparenthouse.Afteratour,thesmartthiefrealizedthat"allhouses
Grandyang
·
2016-04-29 11:00
[
LintCode
/LeetCode] Balanced Binary Tree
ProblemGivenabinarytree,determineifitisheight-balanced.Forthisproblem,aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthetwosubtreesofeverynodeneverdifferbymorethan1.ExampleGivenbinar
linspiration
·
2016-04-29 00:00
recursion
divide-conquer
java
LintCode
:有效数字
LintCode
:有效数字人生苦短,我用Python!
u012225151
·
2016-04-28 21:00
上一页
68
69
70
71
72
73
74
75
下一页
按字母分类:
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
其他