摘要: public class Solution { public string MostCommonWord(string paragraph, string[] banned) { //"a, a, a, a, b,b,b,c, c" paragraph = paragraph.ToLower().Replac... 阅读全文
posted @ 2018-09-30 22:50 Sempron2800+ 阅读(118) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: bool backspaceCompare(string S, string T) { stack ST1; for (int i = 0; i ST2; for (int i = 0; i < T.length(); i++) { char c =... 阅读全文
posted @ 2018-09-30 22:33 Sempron2800+ 阅读(112) 评论(0) 推荐(0) 编辑
摘要: class MyHashMap { public: vector hashMap; /** Initialize your data structure here. */ MyHashMap() { } /** value will always be non-negative. */ void put(int key,... 阅读全文
posted @ 2018-09-30 20:55 Sempron2800+ 阅读(106) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public IList> LargeGroupPositions(string S) { //"babaaaabbb" var list = new List>(); int len = S.Length; if... 阅读全文
posted @ 2018-09-30 20:45 Sempron2800+ 阅读(97) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int FindShortestSubArray(int[] nums) { //先找到最大频度的数字都有哪些,加入到一个集合中 var dic = new Dictionary(); var dic... 阅读全文
posted @ 2018-09-30 18:46 Sempron2800+ 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 使用两种语言实现,先贴C++的 下面贴出C#的 阅读全文
posted @ 2018-09-30 17:52 Sempron2800+ 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 对BST树进行中序遍历,得到递增序列,然后依次计算相邻两元素之间的差,并保存最小的差。 阅读全文
posted @ 2018-09-30 16:44 Sempron2800+ 阅读(76) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: bool isOneBitCharacter(vector& bits) { int len = bits.size(); if (len == 1) { if (bits[0] == 0) { return t... 阅读全文
posted @ 2018-09-30 16:06 Sempron2800+ 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 本题不会做,从网上找到了python3的解法,记录如下。 阅读全文
posted @ 2018-09-30 15:51 Sempron2800+ 阅读(97) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public bool RotateString(string A, string B) { string temp = A; int len = A.Length; int lenB = B.Length; ... 阅读全文
posted @ 2018-09-30 14:14 Sempron2800+ 阅读(83) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int RotatedDigits(int N) { int sum = 0; for (int i = 1; i <= N; i++) { var str = i.ToString(... 阅读全文
posted @ 2018-09-30 13:56 Sempron2800+ 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 本题先寻找字符串中0变1,或者1变0的位置作为分隔位置。然后从这个分隔位置同时向左、右两侧搜索。 找到的左连续串和右连续串,都进行累计。 阅读全文
posted @ 2018-09-30 12:52 Sempron2800+ 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 本题是分支限界法,广度优先搜索,使用map加速查询,防止超时。 阅读全文
posted @ 2018-09-30 11:35 Sempron2800+ 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 本题属于分支限界的题目,广度优先进行搜索。利用访问的数组Visited,记录已经走过的路径,以减少重复计算。 阅读全文
posted @ 2018-09-30 10:59 Sempron2800+ 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 这道题没什么思路,参照网上的答案,再此先做一个记录吧。 阅读全文
posted @ 2018-09-30 09:25 Sempron2800+ 阅读(111) 评论(0) 推荐(0) 编辑