LeetCode Range Sum Query - Mutable Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by updating the element at index i to val. Example: Given... Read More

# Tag Archives: 分治法

# LeetCode Different Ways to Add Parentheses

LeetCode Different Ways to Add Parentheses Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *. Example 1 Input:... Read More

# LeetCode Search a 2D Matrix II

LeetCode Search a 2D Matrix II Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in each column are sorted in... Read More

# LeetCode Pow(x, n)

LeetCode Pow(x, n) Implement pow(x, n). 实现幂指数运算。 如果对x连乘n次，时间复杂度为$$O(n)$$，但使用分治法能降到$$O(\log n)$$。因为可以把$$x^n$$分解为： $$!\begin{equation*} x^n= \begin{cases} x^{\frac{n}{2}}... Read More

# LeetCode Maximum Subarray

LeetCode Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array , the contiguous subarray has the largest sum = 6. click to show more practice. More... Read More

# LeetCode Median of Two Sorted Arrays

LeetCode Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log... Read More

# hihoCoder 1139-二分·二分答案

hihoCoder 1139-二分·二分答案 #1139 :... Read More

# hihoCoder 1133-二分·二分查找之k小数

hihoCoder 1133-二分·二分查找之k小数 #1133 :... Read More

# hihoCoder 1128-二分·二分查找

hihoCoder 1128-二分·二分查找 #1128 :... Read More

# hihoCoder 1070-RMQ问题再临

hihoCoder 1070-RMQ问题再临 #1070 :... Read More