C++ convert integer to digits, as vector code example
Example: C++ convert integer to digits, as vector
// Convert integer to vector of digits
vector<int> int_to_vector(long long n) {
vector<int> vec;
while (n != 0) {
vec.push_back(n%10);
n /= 10;
}
reverse(vec.begin(), vec.end());
return vec;
}