You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Think of the final answer as a sum of weights with + or - sign symbols infront of each weight. Actually, all sums with 1 of each sign symbol are possible.
55
+
</details>
56
+
<details>
57
+
<summary>Hint 2</summary>
58
+
Use dynamic programming: for every possible sum with N stones, those sums +x or -x is possible with N+1 stones, where x is the value of the newest stone. (This overcounts sums that are all positive or all negative, but those don't matter.)
Copy file name to clipboardExpand all lines: problems/range-sum-query-2d-immutable/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@
14
14
<p>Given a 2D matrix <i>matrix</i>, find the sum of the elements inside the rectangle defined by its upper left corner (<i>row</i>1, <i>col</i>1) and lower right corner (<i>row</i>2, <i>col</i>2).</p>
15
15
16
16
<p>
17
-
<imgsrc="/static/images/courses/range_sum_query_2d.png"border="0"alt="Range Sum Query 2D" /><br />
17
+
<imgsrc="https://assets.leetcode-cn.com/aliyun-lc-upload/original_images/range_sum_query_2d.png"border="0"alt="Range Sum Query 2D" /><br />
18
18
<small>The above rectangle (with the red border) is defined by (row1, col1) = <b>(2, 1)</b> and (row2, col2) = <b>(4, 3)</b>, which contains sum = <b>8</b>.</small>
0 commit comments