码迷,mamicode.com
首页 >  
搜索关键字:lintcode    ( 1584个结果
最大平均值子数组
LintCode 给出一个整数数组,有正有负。找到这样一个子数组,他的长度大于等于 k,且平均值最大。 二分平均值,平均值的上限r是单个最大值,下限l是所有数的和. mid=(l+r)/2 设sum[i]=nums[0]+nums[1]+nums[2]...nums[i]-i*mid; 保存m=mi ...
分类:编程语言   时间:2017-06-20 17:48:53    阅读次数:170
[LintCode] Strings Serialization
Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list ...
分类:其他好文   时间:2017-06-18 10:44:35    阅读次数:180
[LintCode] Mirror Numbers
A mirror number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number is mirror. ...
分类:其他好文   时间:2017-06-17 10:13:55    阅读次数:180
[LintCode] System Longest File Path
Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents: The director ...
分类:其他好文   时间:2017-06-17 10:03:46    阅读次数:206
LintCode刷题小记491
题目: 判断一个正整数是不是回文数。 回文数的定义是,将这个数反转之后,得到的数仍然是同一个数。 样例: 11, 121, 1, 12321 这些是回文数。 23, 32, 1232 这些不是回文数。 分析: 回文数就是反转后和自身一样,可利用java中StringBuffer中reverse()这 ...
分类:其他好文   时间:2017-06-16 21:11:50    阅读次数:218
带环链表 II
单链表,问有没有环,若有,找到环的入口. Lintcode上挑战,只许使用常数的空间. 设一个快指针fast,一个慢指针slow,fast每次走2步,slow每次走1步. 若无相遇找到了链尾,则无环,若相遇了,则有环. 设从链头到环入口点走了a步,从环入口到相遇点走了x步,环长r.相遇时,slow走 ...
分类:其他好文   时间:2017-06-16 16:54:54    阅读次数:253
Lintcode36 Reverse Linked List II solution 题解
【题目描述】Reversealinkedlistfrompositionmton.Notice:Givenm,nsatisfythefollowingcondition:1≤m≤n≤lengthoflist.翻转链表中第m个节点到第n个节点的部分注意:m,n满足1≤m≤n≤链表长度【题目链接】http://www.lintcode.com/en/problem/reverse-linked-list-ii/【题目解..
分类:其他好文   时间:2017-06-14 16:17:26    阅读次数:130
【Lintcode】382.Triangle Count
题目: Given an array of integers, how many three numbers can be found in the array, so that we can build an triangle whose three edges length is the thr ...
分类:其他好文   时间:2017-06-13 21:48:00    阅读次数:219
Lintcode35 Reverse Linked List solution 题解
【题目描述】Reversealinkedlist.翻转一个链表【题目链接】http://www.lintcode.com/en/problem/reverse-linked-list/【题目解析】这题要求我们翻转[m,n]区间之间的链表。对于链表翻转来说,几乎都是通用的做法,譬如p1->p2->p3->p4,如果我们要翻转p2和p3,其实就是..
分类:其他好文   时间:2017-06-12 14:40:15    阅读次数:103
Lintcode34 N-Queens II solution 题解
【题目描述】FollowupforN-Queensproblem.Now,insteadoutputtingboardconfigurations,returnthetotalnumberofdistinctsolutions.根据n皇后问题,现在返回n皇后不同的解决方案的数量而不是具体的放置布局。【题目链接】http://www.lintcode.com/en/problem/n-queens-ii/【题目解..
分类:其他好文   时间:2017-06-11 13:03:24    阅读次数:144
1584条   上一页 1 ... 45 46 47 48 49 ... 159 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!