3 ms·
just divide by 1000 until x < 1000 and return int(x) plus a map of number of times divided by 1,000 to MB, GB,... string. Its a O(1) operation because of limit
by strangesmells02 3y ago
just divide by 1000 until x < 1000 and return int(x) plus a map of number of times divided by 1,000 to MB, GB,... string.
Its a O(1) operation because of limited size allowed for numeric types