FastPrepPassword Requirement Check
Problems/Password Requirement Check

Password Requirement Check

DRW logoDRW● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Our version is about 99% the same as the reported question.

Given a string S, determine whether it is a valid password.

A password is valid exactly when all of these rules hold:

  • Its length is at least 6.
  • It contains no space character.
  • It contains at least one decimal digit.
  • It contains at least one lowercase English letter.
  • It contains at least one uppercase English letter.
  • It contains at least one character from !@#$%^&*()_.

Return true when every rule holds; otherwise, return false.

Function

solution(S: String) → boolean

Examples

Example 1

S = "Ab1!cd"return = true

The password has length six, contains every required character category, and contains no space.

Example 2

S = "Ab1 cd!"return = false

The password contains a space, so it is invalid.

Constraints

  • 0 <= S.length <= 100.
  • The allowed special-character set is exactly !@#$%^&*()_.

More DRW Online Assessment questions

  • Count Balanced Nodes in a Rooted TreeOA · Seen Sep 2026
  • Largest Number With Even Digit FrequenciesOA · Seen Sep 2026
  • Shortest Path Around Rectangular ObstaclesOA · Seen Sep 2026
  • 2020 Account Balance with Monthly Card FeesOA · Seen Aug 2026
  • Nested In-Memory Database TransactionsOA · Seen Aug 2026
  • Remove Excess Consecutive CharactersOA · Seen Aug 2026
  • Last Round for Each PlayerOA · Seen Jul 2026
  • Shortest Compressed Length After RemovalOA · Seen Jul 2026
  • Doctor Appointment Slot AssignmentOA · Seen Jul 2026
  • Maximum Even-Sum Neighboring PairsOA · Seen Jul 2026

Similar questions at other companies

  • REST API: Country CodesHackerRank · OAHackerRank interview questions
  • Fill One Exact-Length Binary WindowAmazon · OA
  • Remove Vowels from a StringHSBC · OAHSBC interview questions
  • Branch with the Most FilesCapital One · OACapital One interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Maximum Ones After K OperationsGoldman Sachs · OAGoldman Sachs interview questions
  • Total Each Letter's Count in an Encoded StringIBM · OAIBM interview questions
  • Robot Stops Left or Right (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
All DRW interview questionsSee DRW hiring insights
Saved
class Solution {
    public boolean solution(String S) {
        // Write your code here.
    }
}
Checking account…