FastPrepValidate Input Against Length Bounds
Problems/Validate Input Against Length Bounds

Validate Input Against Length Bounds

Klaviyo logoKlaviyo● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Klaviyo onsite interview. The report only says the task is input validation. We chose the printable ASCII text, the length limits and the function signature. Our version is about 30% the same as the reported question. The report gives Klaviyo as the employer, even though its title mentions Coinbase.

For this exercise, validate a text input against a supplied length rule. Return true exactly when the number of characters in text is at least minLength and at most maxLength; otherwise return false.

  • Both endpoints are inclusive.
  • The text contains only printable ASCII characters. Spaces and punctuation each count as one character.
  • Measure the original text without trimming, changing case or interpreting markup.
  • The supplied bounds are valid: 0 <= minLength <= maxLength.

This rule checks one input value; no UI framework or event wiring is involved.

Function

validateInputLength(text: String, minLength: int, maxLength: int) → boolean

Examples

Example 1

text = "hello"minLength = 3maxLength = 5return = true

The text has five characters, so it satisfies the inclusive interval from three through five.

Example 2

text = ""minLength = 1maxLength = 4return = false

The empty text has length zero, below the supplied minimum of one.

Constraints

  • 0 <= text.length <= 10000.
  • Every text character has an ASCII code from 32 through 126.
  • 0 <= minLength <= maxLength <= 10000.

More Klaviyo interview questions

  • Render Sidebar Labels as HTMLONSITE INTERVIEW · Seen Jul 2025
  • Trace Logs at a Two-Second CadenceONSITE INTERVIEW · Seen Jul 2025
  • Flatten JSON into Repeated Key-Value PairsONSITE INTERVIEW · Seen Oct 2023
  • Conditionally Insert or Update RecordsONSITE INTERVIEW · Seen Jul 2022
  • Progressive Parcel Tracking OperationsOA · Seen Aug 2026
  • Banking Transfers, Account Merges, and Historical BalancesOA · Seen Jul 2025
  • In-Memory Database with Permanent and Expiring ValuesOA · Seen Jul 2025
  • File Storage with User Quotas, Merging, Backups, and RestoreOA · Seen Jun 2025
  • Key-Value Locks with Waiting QueuesOA · Seen Sep 2024

Similar questions at other companies

  • Extract Hashtags from a TweeteBay · ONSITE INTERVIEWeBay interview questions
  • Non-Repeating CharacterAutodesk · ONSITE INTERVIEWAutodesk interview questions
  • Container Ledger with TradesFlexport · ONSITE INTERVIEWFlexport interview questions
  • Christmas Tree with N TiersVerily · ONSITE INTERVIEW
  • Longest Common PrefixKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Valid ParenthesesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Count Adjacent Symbol Pairs for BPEAmazon · ONSITE INTERVIEW
  • Longest Spoken PrefixElevenLabs · ONSITE INTERVIEWElevenLabs interview questions
  • Palindrome Check Ignoring SymbolsWalmart · ONSITE INTERVIEWWalmart interview questions
  • Reverse a String Keeping Dashes in PlaceNykaa · ONSITE INTERVIEWNykaa interview questions

Klaviyo interview experiences

  • Klaviyo SWE Intern Interview Questions: 15 Experiences
All Klaviyo interview questionsSee Klaviyo hiring insights
Saved
class Solution {
    public boolean validateInputLength(String text, int minLength, int maxLength) {
        // Write your code here
    }

}
Checking account…