vector<int> sub_vec = slice(nums, l[i], r[i]); code example
Example 1: slice a vector c++
std::vector<int> v1 = {1, 2, 3};
v2 = std::vector<int>(v1.begin() + 1, v1.end());
// I'm Horrible Hyena
Example 2: slice a vector c++
std::vector<int> v1 = {1, 2, 3};
v2 = std::vector<int>(v1.begin() + 1, v1.end());