摘要: 1 class Solution(object): 2 def __init__(self): 3 self.List = list() 4 5 def rdfs(self,S): 6 if S != '': 7 length = len(S) 8 depth = len(self.... 阅读全文
posted @ 2019-04-14 18:20 Sempron2800+ 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 最直接的思路是三层循环,但是会超时,代码如下: 但同样的代码,使用java实现,却可以正常提交,leetcode对这道题目的的判断机制有点奇怪。 如果想解决超时问题,可以考虑使用哈希或者dp思想,来减少判断的时间。 这种题目,做起来很麻烦,看看别人的思路吧。 当时没想出来怎么做,经过一段时间的练习( 阅读全文
posted @ 2019-04-14 12:43 Sempron2800+ 阅读(673) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution 2 { 3 Stack S = new Stack(); 4 int maxValue = 0; 5 public void Trace(TreeNode root) 6 { 7 if (root != null) 8 ... 阅读全文
posted @ 2019-04-14 12:29 Sempron2800+ 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution 2 { 3 public bool DivisorGame(int N) 4 { 5 if (N % 2 == 1) 6 { 7 return false; 8 } 9 ... 阅读全文
posted @ 2019-04-14 12:28 Sempron2800+ 阅读(89) 评论(0) 推荐(0) 编辑