Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Need help in java please! Thanks

image text in transcribed

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 assessment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions