e10cc4257d
- gen-flashcards.py: auto-generate recognition cards from all problem files - toolkit/gen-problem-cards.org: 199 auto-generated problem cards - 5 binary search tool cards (std::binary_search, std::lower_bound, comparison, two-sum pattern, sorting gotcha) - two-sum.org: add binary search C++ attempt - lc-org.el: add doom emacs localleader keybinding support
387 B
387 B
std::binary_search: check element exists :cpp:binary-search:algorithm:retrieval::recognition:
Front
What does std::binary_search return, and what must the range be?
Back
Returns bool (true if element found). The range must be sorted.
bool found = std::binary_search(vec.begin(), vec.end(), value);