← Amazon Interview Insights

Amazon·Software Engineer·Online Assessment (OA)·Intermediate

Intermediate
May 2026

Summary

Amazon SWE online assessment with a string manipulation problem around credential validation. Pretty standard OA fare but the output wasn't immediately obvious to me.

Questions Asked (1)

Q1

Given a string representing a login credential (lowercase letters only), determine its strength value. A credential is only valid if it contains at least one vowel and at least one consonant. Return the strength value, or 0 if the credential doesn't meet the criteria.

Algorithms & Data Structures
Author's notes

I stared at the example for a while because the output of 3 for 'hackerrank' wasn't clicking at first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the definition of 'strength value' since it's not specified in the problem statement. Then, validate the string by checking for at least one vowel and one consonant, and finally compute the strength according to the clarified definition, returning 0 if invalid.

Pro tip: Always ask clarifying questions before coding; in this case, the strength calculation is ambiguous, so confirming it with the interviewer shows attention to detail and prevents wasted effort.

1. Clarify the problem

Ask the interviewer to define 'strength value' and confirm any constraints (e.g., string length, character set).

2. Validate the credential

Check if the string contains at least one vowel (a, e, i, o, u) and at least one consonant (non-vowel lowercase letter).

3. Compute strength

Based on the clarified definition, calculate the strength value (e.g., count of vowels, consonants, or a formula).

4. Handle invalid cases

If the string fails validation, return 0 immediately.

5. Test and optimize

Walk through examples, consider edge cases (empty string, all vowels, all consonants), and discuss time/space complexity.

Key Points to Mention

  • Definition of vowels and consonants (lowercase letters only).
  • Validation condition: at least one vowel and one consonant.
  • Return 0 for invalid credentials.
  • Clarify the strength calculation (e.g., count of vowels, consonants, or a specific formula).
  • Edge cases: empty string, single character, all vowels, all consonants.
  • Time and space complexity: O(n) time, O(1) space.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.