Company: Salesforce_10_feb
Difficulty: medium
Safe Passwords Description Salesforce provides a secure system for organizations to manage their accounts and user data. To ensure maximum security, Salesforce has implemented password policies for user accounts. A password is considered safe if it satisfies the following criteria: The length of the password is exactly n . The password consists of lowercase English characters only. The password does not contain k or more consecutive identical characters. Given the integers n (password length) and k (maximum allowed consecutive identical characters is k-1 ), calculate the total number of distinct safe passwords that can be generated. Since the number can be large, return the result modulo (10 9 + 7). Example 1 Input: n = 2, k = 2 Output: 650 Explanation: The total number of passwords of length 2 is 26 * 26 = 676. A password is not safe if it has 2 or more consecutive identical characters. The invalid passwords are "aa", "bb", ..., "zz". There are 26 such passwords. Thus, the number of s