摘要:
Solution 1: Solution with out using % 阅读全文
摘要:
Refer to: https://discuss.leetcode.com/topic/58334/a-couple-of-java-solutions-with-explanations/2 When to add 1 instead of minus 1, here is an example 阅读全文
摘要:
Analysis: Given a string s, find out all chars that are invalid (i.e., count < k). The longest substring must reside in one of the substrings divided 阅读全文
摘要:
F(0) = (0 * 4) + (1 * 3) + (2 * 2) + (3 * 6) = 0 + 3 + 4 + 18 = 25 [4, 3, 2, 6] F(1) = (0 * 6) + (1 * 4) + (2 * 3) + (3 * 2) = 0 + 4 + 6 + 6 = 16 [6, 阅读全文
摘要:
这道题题干给出了判断 one single UTF-8 char的方法,然后给一个UTF-8 char sequence,判断是不是正确sequence. (读题读了很久) 这道题关键是要学到用 & 取出一个bit sequence当中几位的方法 二进制数表示法:在前面加 0b, 八进制加0o, 十 阅读全文
摘要:
自己的做法:这种括号问题肯定是用栈,最好是先在栈里存一个空元素,然后stack.peek().append()各种操作 一个栈存string, 一个栈存number, 维护一个指针numStart指向数字的开始 1. 遇到数字啥也不做 2. 遇到char: stack.peek().append(c 阅读全文
摘要:
Refer to https://discuss.leetcode.com/topic/56052/really-easy-understanding-solution-o-n-java and https://discuss.leetcode.com/topic/55923/o-n-solutio 阅读全文