python3 solution 
Code

# Code
```python3 []
import math

def lucas_theorem(n: int, k: int, p: int):
    """
    Computes nCk % p using Lucas's theorem.
    """
    product = 1
    while n != 0 or k != 0:
        n_dig = n % p
        k_dig = k % p
        if k_dig > n_dig:
            return 0
        product *= math.comb(n_dig, k_dig)
        product %= p
        n //= p
        k //= p
    return product

def binom(n, k):
    """
    Computes nCk mod 10 using properties of modular arithmetic
    and Lucas's theorem for mod 2 and mod 5.
    """
    m2 = lucas_theorem(n, k, 2)
    m5 = lucas_theorem(n, k, 5)

    if m2 == 0:
        return [0, 6, 2, 8, 4][m5]  # Mapping based on mod values
    else:
        return [5, 1, 7, 3, 9][m5]

class Solution:
    def hasSameDigits(self, s: str) -> bool:
        """
        Checks if the last row of Pascal's Triangle constructed from the input digits 
        results in two equal last digits.
        """
        n1, n2 = 0, 0
        length = len(s)

        for i in range(length - 1):
            multiple = binom(length - 2, i)
            n1 = (n1 + multiple * int(s[i])) % 10
            n2 = (n2 + multiple * int(s[i + 1])) % 10

        return n1 == n2

```
['Python3']