Ad
Numbers
Data Types
Integers
Algorithms
Logic
Code
Diff
  • #include <stdio.h>
    #include <stdint.h>
    #include <inttypes.h>
    
    uint_fast8_t number_of_digits(uint64_t n)
    {
        char buf[32];
        return snprintf(buf, 32, "%" PRIu64, n);
    }
    • #include <stdio.h>
    • #include <stdint.h>
    • #include <inttypes.h>
    • uint_fast8_t number_of_digits(uint64_t n)
    • {
    • return printf("%lu", n);
    • char buf[32];
    • return snprintf(buf, 32, "%" PRIu64, n);
    • }
Code
Diff
  • export function reverseInt(n: number) {
      return +String(n).split('').reverse().join('')
    }
    • export function reverseInt(n: number) {
    • return parseInt(new String(n).split('').reverse().join(''))
    • return +String(n).split('').reverse().join('')
    • }
Code
Diff
  • function count(string) {
      return string.replace(/[^a]+/gi, '').length
    }
    • function count(string) {
    • return (string.match(/a/gi) || []).length;
    • return string.replace(/[^a]+/gi, '').length
    • }
Code
Diff
  • from operator import add
    • add=int.__add__
    • from operator import add