Accenture OA-30 2024
Problem Description
You are given a function checkPassword (char str[] , int n) :
Return 1 if it is a valid password else return 0 if it is not.
String is a valid password if it satisfies the following conditions:
- At least 4 characters.
- At least 1 numeric.
- At least one capital letter.
- No space or slash (/)
- The starting char must not be a number.
Input Format:
- The input will consist of a single string representing the password.
Output Format:
The output will be a single integer, either 1 or 0, indicating whether the password is valid or not.
Constraints:
- The length of the password string will be between 1 and 100.
- Each character of the password string will be an ASCII character.
Example
Sample Input:
Password123
Sample Output:
1
Explanation:
The given password "Password123" satisfies all the conditions:
- It has a length of 10, which is greater than 4.
- It contains a numeric digit '1' and '2'.
- It contains an uppercase letter 'P'.
- It does not contain any spaces or slashes.
- The first character 'P' is not a numeric digit.
Therefore, the function returns 1 indicating that the password is valid.