摘要:
https://leetcode.com/problems/decode-string/ public class Solution { private String s; private int newPos; public String decodeString(String ins) { s = '.' + ins + ']'; ... 阅读全文
摘要:
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()... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
https://leetcode.com/problems/longest-absolute-file-path/ public class Solution { public int lengthLongestPath(String input) { Stack stk = new Stack(); int left = 0; int ... 阅读全文
摘要:
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) { ... 阅读全文
摘要:
https://leetcode.com/problems/lexicographical-numbers/ public class Solution { public List lexicalOrder(int n) { List ret = new ArrayList(); int cur = 1; ret.add(cur); ... 阅读全文
摘要:
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... 阅读全文
摘要:
https://leetcode.com/problems/shuffle-an-array/ public class Solution { int [] origNums; int [] shufNums; java.util.Random rd; public Solution(int[] nums) { origNums = nums... 阅读全文