Add subarray sum equals K flashcards (LC 560, 974, 325)

This commit is contained in:
2026-05-26 01:15:40 +08:00
parent 3ab8ba001d
commit 978ab00faa
2 changed files with 183 additions and 0 deletions
+16
View File
@@ -81,3 +81,19 @@ public:
}
};
#+end_src
* TODO study: why min doesn't work with Fenwick tree (no inverse, update breaks on increase)
* Binary search
#+begin_src python
def bs(a, x, l, r):
if l >= r:
return l
m = l + (r-l) // 2
if (a[m] < x):
return bs(a, x, m+1, r);
else:
return bs(a, x, l, m)
#+end_src