Min Time After Which the Password Becomes Irrecoverable
Database security and authentication have become vital due to the increasing number of cyberattcks every day. Amazon has created a team for the analysis of various types of cyberattacks. In one such analysis, the team finds a virus that attacks the user passwords. The virus designed has an attacking rule defined by attackOrder, which is a permutation of length n. In the i-th second of the attack, the virus attacks at the attackOrder[i]-th character of the password, replacing it with the malicious character '*' (source img too blurry, it looks like '*' to me, if not, pls lmk, I am happy to modify accordingly! You are the best! Thanks a lot!), i.e, pwassword[attackOrder[i]] = '*' after the i-th second.
The password is said to be irrecoverable when the number of surroundings of the password containing at least one malicious character '*' becomes greater than or equal to n. In order to estimate the threat posed by the virus, the team wishes to find the min time after which the password becomes irrecoverable.
Note:
Complete the function helpAmazonFindMinTimeAgain in the editor.
helpAmazonFindMinTimeAgain has the following parameter:
string password: the inital passwordint attackOrder[]: permutation arr of integers [1, 2,.., n]int m: the recoverability parameter
Returns
int: the minimum time after which the password becomes irrecoverable.
1Example 1

2Example 2
Constraints
Limits and guarantees your solution can rely on.
1 <= n <= 8 * 10^5
String password consists of lowercase English chars
1 <= attackOrder[i] <= n
0 <= m <= n * (n + 1) / 2