上一页 1 ··· 73 74 75 76 77 78 79 80 81 ··· 114 下一页
摘要: public class Solution { public string ShortestCompletingWord(string licensePlate, string[] words) { var list = words.OrderBy(x => x.Length); var pattern = ... 阅读全文
posted @ 2018-10-21 18:56 Sempron2800+ 阅读(103) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public bool IsLongPressedName(string name, string typed) { var list1 = new List>(); var list2 = new List>(); int name_... 阅读全文
posted @ 2018-10-21 17:36 Sempron2800+ 阅读(107) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: stack OPD; stack OPR; int calculate(int num1, int num2, char opr){ switch (opr){ case '+':{ return num1 + num2; } ... 阅读全文
posted @ 2018-10-19 11:04 Sempron2800+ 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Java版本:先将数组排序,从中间将排好序的数组分为small部分和large部分。 每次从小区间找一个值插入偶数位,从大区间找一个值插入奇数位。 补充一个python的版本: 阅读全文
posted @ 2018-10-18 20:12 Sempron2800+ 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 补充一个python的实现: 阅读全文
posted @ 2018-10-18 19:41 Sempron2800+ 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 因为nums可能包含负数,因此之前最小的乘积*当前值,有可能成为最大值;而之前最大的乘积*当前值,有可能成为最小值。 因此,每次计算的时候,把目前的最大乘积和最小乘积都保存下来,用于下一次计算。 补充一个python的实现: 阅读全文
posted @ 2018-10-18 19:29 Sempron2800+ 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 补充一个python的实现: 阅读全文
posted @ 2018-10-15 15:01 Sempron2800+ 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 补充一个python的实现: 阅读全文
posted @ 2018-10-15 14:58 Sempron2800+ 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 使用python实现: 下面补充另一种思路,使用python实现,是根据leetcode167 twonum II的思路来做的,效率比上面的方法要高一些,代码如下: 阅读全文
posted @ 2018-10-15 14:55 Sempron2800+ 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 本题是动态规划的题目,vec[i,j]记录的是以matrix[i,j]为右下角的所能构成的正方形区域的边长的最大值。 递推公式,vec[i][j] = 1 + min(min(vec[i-1][j],vec[i][j-1]),vec[i-1][j-1]),计算的是当前单元格的“左”、“上”、“左上” 阅读全文
posted @ 2018-10-14 20:06 Sempron2800+ 阅读(232) 评论(0) 推荐(0) 编辑
上一页 1 ··· 73 74 75 76 77 78 79 80 81 ··· 114 下一页