Find Maximum Number of Strings

Asked at Moveworks · Coding Questions · Difficulty: Medium

You are given 2 integers `n` and `k`. We have to find the maximum possible number of strings of size `n` such that the difference between 2 adjacent characters in the string is less than or equal to `k`. All characters of the string should be smallcase alphabets.\n\nThe difference between 2 characters means the difference between their position in the alphabet list. For example, `f - c = 3`, `b - a = 1`.\n\n## Constraints\n- `1 <= n <= 10^6`\n- `1 <= k <= 25`\n\n## Example\n

Loading the problem…