Binomial Approach + Code + Video Explanation
Video ExplanationCode
# Video Explanation
https://www.youtube.com/watch?v=g5Ygoa9uRQc

# Code
```cpp []
static int boost = [](){std::ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);return 0;}();
class Solution {
public:
    int getBinCoeffMod10(int n, int k) {
        int coeffMod2 = getBinCoeffMod2(n, k);
        int coeffMod5 = getBinCoeffMod5(n, k);
        for (int i = 0; i < 10; i++) {
            if (i % 2 == coeffMod2 && i % 5 == coeffMod5)
                return i;
        }
        return 0;
    }

    int getBinCoeffMod2(int n, int k) {
        while (k > 0) {
            if ((k & 1) > (n & 1))
                return 0;
            n >>= 1;
            k >>= 1;
        }
        return 1;
    }

    int getBinCoeffMod5(int n, int k) {
        int res = 1;
        while (n > 0 || k > 0) {
            int nd = n % 5;
            int kd = k % 5;
            if (kd > nd)
                return 0;
            res = (res * getBinCoeff(nd, kd)) % 5;
            n /= 5;
            k /= 5;
        }
        return res;
    }

    int getBinCoeff(int n, int k) {
        if (k > n)
            return 0;
        int fact[5] = {1, 1, 2, 1, 4};
        int numerator = fact[n];
        int denominator = (fact[k] * fact[n - k]) % 5;
        int deninv = 0;
        for (int i = 0; i < 5; i++) {
            if ((denominator * i) % 5 == 1) {
                deninv = i;
                break;
            }
        }
        return (numerator * deninv) % 5;
    }

    bool hasSameDigits(string s) {
        int n = s.size();
        int iterations = n - 2;
        int first = 0, second = 0;
        for (int i = 0; i <= iterations; ++i) {
            int coefficient = getBinCoeffMod10(iterations, i);
            int digit1 = s[i] - '0';
            int digit2 = s[i + 1] - '0';
            first = (first + coefficient * digit1) % 10;
            second = (second + coefficient * digit2) % 10;
        }
        return first == second;
    }
};
```
['Math', 'Bit Manipulation', 'Combinatorics', 'C++']