摘要: https://leetcode.com/problems/decode-string/ public class Solution { private String s; private int newPos; public String decodeString(String ins) { s = '.' + ins + ']'; ... 阅读全文
posted @ 2016-09-17 15:38 blcblc 阅读(219) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/utf-8-validation/ public class Solution { public boolean validUtf8(int[] data) { int last = 0; for (int i=0; i 0) { if (str.length()... 阅读全文
posted @ 2016-09-16 23:06 blcblc 阅读(273) 评论(0) 推荐(0)
摘要: public class Solution { public boolean isSubsequence(String s, String t) { int idx = 0; for (int i=0; i<t.length()&&idx<s.length(); i++) { if (s.charAt(idx) == t.charA... 阅读全文
posted @ 2016-09-16 22:41 blcblc 阅读(119) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/perfect-rectangle/ // https://discuss.leetcode.com/topic/55944/o-n-log-n-sweep-line-solution public class Solution { public class Column implements Comparabl... 阅读全文
posted @ 2016-08-30 19:49 blcblc 阅读(191) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/find-the-difference/ public class Solution { public char findTheDifference(String s, String t) { char[] sch = s.toCharArray(); char[] tch = t.toChar... 阅读全文
posted @ 2016-08-30 17:13 blcblc 阅读(183) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/longest-absolute-file-path/ public class Solution { public int lengthLongestPath(String input) { Stack stk = new Stack(); int left = 0; int ... 阅读全文
posted @ 2016-08-30 01:05 blcblc 阅读(200) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/first-unique-character-in-a-string/ public class Solution { public int firstUniqChar(String s) { int[] index = new int[26]; for (int i=0; i 0) { ... 阅读全文
posted @ 2016-08-29 11:59 blcblc 阅读(250) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/lexicographical-numbers/ public class Solution { public List lexicalOrder(int n) { List ret = new ArrayList(); int cur = 1; ret.add(cur); ... 阅读全文
posted @ 2016-08-29 00:23 blcblc 阅读(171) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/mini-parser/ /** * // This is the interface that allows for creating nested lists. * // You should not implement it, or speculate about its implementation * public i... 阅读全文
posted @ 2016-08-28 23:31 blcblc 阅读(331) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/shuffle-an-array/ public class Solution { int [] origNums; int [] shufNums; java.util.Random rd; public Solution(int[] nums) { origNums = nums... 阅读全文
posted @ 2016-08-28 16:05 blcblc 阅读(161) 评论(0) 推荐(0)