classSolution { public: string largestOddNumber(string num){ constint n = num.size(); int i = n - 1; for(; i >= 0; --i) { // if ((num[i] - '0') & 1) break; if (num[i] & 1) break; // ASCII code of an odd/even is also an odd/even. } return num.substr(0, i + 1); } };