Python Math
\n"""\nfind the greatest x such that \n    1*x + 26*(n-x) >= k\n    26n - 25x >= k\n    26n - k >= 25x\n    (26n-k)/25 >= x\n    \n    x = floor((26n-k)/25)\n  
```\n"""\nfind the greatest x such that \n    1*x + 26*(n-x) >= k\n    26n - 25x >= k\n    26n - k >= 25x\n    (26n-k)/25 >= x\n    \n    x = floor((26n-k)/25)\n    \n    numeric_val = 1*x + 26*(n-x)\n    string = [1]*x + [26-(numeric_val-k)] + [26]*(n-x-1)\n"""\n\n\nclass Solution:\n    def getSmallestString(self, n, k):\n        """\n        Args:\n            n (int): length of string\n            k (int): numeric value of string (sum of value of char)\n        \n        Returns:\n            res (string): smalleest string\n        """\n        num_a = floor((26*n-k)/25)\n        numeric_val = 1*num_a + 26*(n-num_a)\n        mid = chr(ord(\'a\')+26-(numeric_val-k)-1)  # careful for 1-index\n        res = \'a\'*num_a + mid*1 + \'z\'*(n-num_a-1)\n        return res\n```
[]