algorithms

Algorithm implementations
git clone git://git.laack.co/algorithms.git
Log | Files | Refs | README

remove-trailing-zeroes.cpp (284B)


      1 class Solution {
      2 public:
      3     string removeTrailingZeros(string num) {
      4         int properLength = num.length() - 1;
      5 
      6         while (num[properLength] == '0'){
      7             properLength -= 1;
      8         }
      9         
     10         num.resize(properLength + 1);
     11         
     12         return num;
     13     }
     14 };