When solving problems on Leetcode
, we often utilize data structures from the STL
. Here, I document some commonly used syntax.
string
- substring extraction
1 2 3 4 5
| // return s[pos, pos+n) s.substr(pos, n)
// return s[pos, s.size()) s.substr(pos)
|
vector
- len
map
unordered_map