Need help in java please! Thanks You would like to set a password for an email a
ID: 3734739 • Letter: N
Question
Need help in java please! Thanks
You would like to set a password for an email account. However, there are two restrictions on the forma of the password. It has to contain at least one uppercase character and it cannot contain any digits. You are given a string S consisting of N alphanumerical characters. You would like to find the longest substring of S that is a valid password. A substring is defined as a contiguous segment of a string. For example, given "", the substrings that are valid passwords are "B" and "Ba". Note that "" is n substring and "aes" is not a valid password. Write a function: class Solution public int solution(String S); of N characters, returns the length of its longest substring th is a valid password. If there is no such substring, your function should return -1. For example, given "", your function should return 2, as explained above. Given "aebb", your function should return -1, since there is no substring that satisfies the restrictions on the format of a valid password Assume that: N is an integer within the range [1.200]; string S consists only of alphanumerical characters (a-z and/or A-Z and/or e-9). In your solution, focus on correctness. The performance of your solution will not be the focus of the assessmentExplanation / Answer
Below is the Java code for above problem with proper description provided within comments itself. Below code some sample output screenshots are attached.
If you need any other help for this Comment me below.
Java code :
Sample Output :
2
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.