01 2016 档案
摘要:火柴拼出多少个正方形 http://matchstickpuzzles.blogspot.com/2011/06/55-4x4-square-how-many-squares.html 输入是两个二维数组ver 和 hor, 若是有火柴就是1, 没有就是0. dpHor 表示横方向上有多少连续火柴,
阅读全文
摘要:常用iterate 方法
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/bulb-switcher/ 题目: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/maximum-product-of-word-lengths/用mark[i]数组来标记 words[i]都含有哪些字母,假若有个'c', 就在第三位上有个1.通过mark[i] & mark[j] 是否为0来确定是否有相...
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/rotate-array/ 题目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/summary-ranges/ 题目: Given a sorted integer array without duplicates, return the summary of its ranges. Example 1
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/string-to-integer-atoi/ 题目: Implement atoi which converts a string to an integer. The function first discards as
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/reverse-integer/ 题目: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output:
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/range-sum-query-mutable/ 题目: Given an integer array nums, find the sum of the elements between indices i and j (
阅读全文
摘要:原题链接在这里:http://www.lintcode.com/en/problem/a-b-problem/不让用 数学运算符,就用位运算符。a的对应位 ^ b的对应位 ^ carry 就是res中的对应位。carry 更新为0还是1要分别讨论。Time Complexity: O(1), 一共3...
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/power-of-three/ 题目: Given an integer, write a function to determine if it is a power of three. Example 1: Exampl
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/pascals-triangle-ii/ 题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3
阅读全文
摘要:原题链接在这里:https://leetcode.com/problems/pascals-triangle/ 题目: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows
阅读全文