Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [[nodiscard]] auto slidingWindow(const std::vector<int>& vec, /* */) -> /* */{
- std::size_t l = 0;
- const auto addIndex = [&](std::size_t index){
- // TODO: expand bound
- };
- const auto removeIndex = [&](std::size_t index){
- // TODO: shrink bound
- };
- const auto updateBound = [&](std::size_t r){
- addIndex(r);
- while(/* TODO: condition that make bound invalid */){
- removeIndex(l);
- l++;
- }
- };
- for(std::size_t r = 0; r < vec.size(); r++){
- updateBound(r);
- // TODO: do things with your bounds
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment