leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1903.cpp (238B)


      1 class Solution {
      2   public:
      3     string largestOddNumber(const string &num) const {
      4         for (int i = num.size() - 1; i >= 0; i--) {
      5             if ((num[i] & 0x1F) % 2) return num.substr(0, i + 1);
      6         }
      7         return "";
      8     }
      9 };