java.lang.Object
g2201_2300.s2299_strong_password_checker_ii.Solution

public class Solution extends Object
2299 - Strong Password Checker II.<p>Easy</p> <p>A password is said to be <strong>strong</strong> if it satisfies all the following criteria:</p> <ul> <li>It has at least <code>8</code> characters.</li> <li>It contains at least <strong>one lowercase</strong> letter.</li> <li>It contains at least <strong>one uppercase</strong> letter.</li> <li>It contains at least <strong>one digit</strong>.</li> <li>It contains at least <strong>one special character</strong>. The special characters are the characters in the following string: <code>&quot;!@#$%^&*()-+&quot;</code>.</li> <li>It does <strong>not</strong> contain <code>2</code> of the same character in adjacent positions (i.e., <code>&quot;aab&quot;</code> violates this condition, but <code>&quot;aba&quot;</code> does not).</li> </ul> <p>Given a string <code>password</code>, return <code>true</code> <em>if it is a <strong>strong</strong> password</em>. Otherwise, return <code>false</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> password = &ldquo;IloveLe3tcode!&rdquo;</p> <p><strong>Output:</strong> true</p> <p><strong>Explanation:</strong> The password meets all the requirements. Therefore, we return true.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> password = &ldquo;Me+You&ndash;IsMyDream&rdquo;</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> The password does not contain a digit and also contains 2 of the same character in adjacent positions. Therefore, we return false.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> password = &ldquo;1aB!&rdquo;</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> The password does not meet the length requirement. Therefore, we return false.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= password.length <= 100</code></li> <li><code>password</code> consists of letters, digits, and special characters: <code>&quot;!@#$%^&*()-+&quot;</code>.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • strongPasswordCheckerII

      public boolean strongPasswordCheckerII(String password)