摘要:
Binary Indexed Tree的作用 Binary Indexed Tree(BIT)现多用于高效计算数列的前序和,区间和。它可以在O(logn)的时间得到任意的前序和(prefix sum)。如一个array[2,5,-1,3,6],要计算第2个元素到第4个元素的和:5+-1+3=7。 B 阅读全文
摘要:
package LeetCode_1356 import java.util.* /** * 1356. Sort Integers by The Number of 1 Bits * https://leetcode.com/problems/sort-integers-by-the-number 阅读全文
摘要:
package LeetCode_190 /** * 190. Reverse Bits * https://leetcode.com/problems/reverse-bits/description/ * Reverse bits of a given 32 bits unsigned inte 阅读全文
摘要:
/** * 3. Longest Substring Without Repeating Characters * https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ * 阅读全文
摘要:
/** * 989. Add to Array-Form of Integer * https://leetcode.com/problems/add-to-array-form-of-integer/description/ * For a non-negative integer X, the 阅读全文
摘要:
/** * 896. Monotonic Array * https://leetcode.com/problems/monotonic-array/description/ * */ class Solution { fun isMonotonic(A: IntArray): Boolean { 阅读全文
摘要:
package LeetCode_253 import LeetCode_252.Interval import java.util.Arrays /** * 253. Meeting Rooms II * (Lock by Leetcode) * https://www.lintcode.com/ 阅读全文
摘要:
/** * 461. Hamming Distance * https://leetcode.com/problems/hamming-distance/description/ * The Hamming distance between two integers is the number of 阅读全文
摘要:
import java.util.Arrays /** * 252. Meeting Rooms * (Locked by Leetcode) * https://www.lintcode.com/problem/meeting-rooms/description * Given an array 阅读全文
摘要:
import kotlin.collections.HashMap /** * 146. LRU Cache * https://leetcode.com/problems/lru-cache/description/ * * 我们需要设计: * 1:使用HashMap:用于存储现有的key,val 阅读全文