aboutsummaryrefslogtreecommitdiff
path: root/thousand_separator.cpp
blob: a0493f5d8bfb63a4d754e9904ad405e0f86503a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "leetcode.h"
#include <cmath>
#include <string>

class Solution {
public:
  string thousandSeparator(int n) {
    string s = to_string(n);
    if (trunc(log10(n)) + 1 < 4)
      return s;

    return s;
  }
};

int main() {
  Solution obj;
  obj.thousandSeparator(1234);
  // cout << obj.thousandSeparator(1234);
}