摘要:
public class Solution { public int[] DiStringMatch(string S) { var len = S.Length; var min = 0; var max = len; var list = new List(...
阅读全文
posted @ 2018-11-18 18:49
Sempron2800+
阅读(157)
推荐(0)
摘要:
public class Solution { public bool ValidMountainArray(int[] A) { bool findTop = false; if (A.Length 1) { ...
阅读全文
posted @ 2018-11-18 18:38
Sempron2800+
阅读(124)
推荐(0)
摘要:
补充一份C++的实现: 提交显示错误的问题,我这里没有遇到,截图如下:
阅读全文
posted @ 2018-11-12 15:37
Sempron2800+
阅读(307)
推荐(0)
摘要:
public class RecentCounter { Queue Q; public RecentCounter() { Q = new Queue(); Q.Clear(); } public int Ping(int t) { ...
阅读全文
posted @ 2018-11-04 17:58
Sempron2800+
阅读(138)
推荐(0)
摘要:
package main import ( "fmt" "strings" ) func numUniqueEmails(emails []string) int { var dic map[string]int dic = make(map[string]int) for _, s := range emails { strArr :...
阅读全文
posted @ 2018-10-28 21:03
Sempron2800+
阅读(124)
推荐(0)
摘要:
补充一个非常复杂,不美观的版本,使用python实现,也可以AC,能写出来我也挺佩服自己的。 这个版本的主要思想就是从后向前找,记录已查找范围的最大值,当查找到一个值a比已查找区域的最大值maxnum要小的时候,就可以进行换位操作了。 但是要确定一个在已查找区域中比a值大的最小的那个值来进行交换。所
阅读全文
posted @ 2018-10-23 15:49
Sempron2800+
阅读(227)
推荐(0)
摘要:
不使用乘法、除法、求余数,计算两个数字相除。 使用加法和减法运算。 Java实现代码如下: 上述代码用实际的例子进行解释,假设a=10,b=3,主要介绍10~19行的循环体的逻辑。 外部循环1:判断 3 <= 10满足 内部循环1.1:3 + 3 <= 10满足,count = 2,sum = 6
阅读全文
posted @ 2018-10-21 21:03
Sempron2800+
阅读(142)
推荐(0)
摘要:
public class Solution { public String fractionToDecimal(int numerator, int denominator) { HashMap maps = new HashMap();//store divid number List number = new ArrayList(); ...
阅读全文
posted @ 2018-10-21 21:02
Sempron2800+
阅读(127)
推荐(0)
摘要:
C++实现,使用BFS: 补充一个python的实现,使用DFS:
阅读全文
posted @ 2018-10-21 21:00
Sempron2800+
阅读(163)
推荐(0)
摘要:
补充一个python的实现: 参考:https://leetcode.com/problems/decode-ways/discuss/30529/Readable-Python-DP-Solution 本题关键在于第11行到15行之间的逻辑,更新dp[i]的规则。 dp[i]表示,前i个字符(从1
阅读全文
posted @ 2018-10-21 20:57
Sempron2800+
阅读(184)
推荐(0)