FastPrepClassify Password Strength
Problems/Classify Password Strength

Classify Password Strength

HackerRank logoHackerRank● MediumINTERNFULLTIMEOAPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives all three weak-character categories, the boundary of six characters, matching dictionary substrings, ordered labels, and a trie as a follow-up for preprocessing. We chose case sensitivity and the input limits. Our version is about 95% the same as the reported question.

Special thanks: 🌷 A special thank you to a lovely, amazing fren who shared that this question appeared again on November 16, 2026! ( ˘͈ ᵕ ˘͈♡) 🩵

Classify every string in passwords as "weak" or "strong".

A password is weak when it has fewer than six characters, consists entirely of digits, entirely of lowercase letters, or entirely of uppercase letters, or contains any string from commonWords as a case-sensitive substring. Otherwise it is strong. Return classifications in input order.

Function

classifyPasswords(passwords: String[], commonWords: String[]) → String[]

Examples

Example 1

passwords = ["abc123","ABCDEF","Abc!23"]commonWords = ["password"]return = ["strong","weak","strong"]

The mixed alphanumeric and mixed-symbol passwords pass, while the all-uppercase password is weak.

Example 2

passwords = ["mySecret1","safeA1"]commonWords = ["Secret"]return = ["weak","strong"]

The first password contains a blocked substring with matching case.

Constraints

  • 1 <= passwords.length <= 1000.
  • 0 <= passwords[i].length <= 1000.
  • 0 <= commonWords.length <= 1000, and every common word is nonempty.
  • Inputs contain ASCII characters, and substring matching is case-sensitive.

More HackerRank interview questions

  • Check Permutation Divisible by EightONSITE INTERVIEW · Seen Mar 2026
  • REST API: Country CodesOA · Seen Nov 2026
  • Auction Lot Bid SummaryOA · Seen Nov 2026
  • Ball Passing at Time KPHONE SCREEN · Seen Dec 2025
  • Longest Equal Binary SubarrayOA · Seen Dec 2025
  • Longest Equal Binary Subarray After One FlipOA · Seen Dec 2025
  • Longest Prefix-Valid Binary SubarrayOA · Seen May 2025

Similar questions at other companies

  • Dasher Pay with Store Waits and Peak HoursDoorDash · PHONE SCREENDoorDash interview questions
  • Travelers per Consecutive City TripletUber · ONSITE INTERVIEWUber interview questions
  • Invoice / Payment ReconciliationStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Highest Bid Campaign MatcherStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
  • Fuzzy Word Lookup With One Misspelled LetterMeta · PHONE SCREENMeta interview questions
  • Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
All HackerRank interview questionsSee HackerRank hiring insights
Saved
class Solution {
    public String[] classifyPasswords(String[] passwords, String[] commonWords) {
        // Write your code here.
    }
}
Checking account…