PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Amazon

Find minimum time for irrecoverable password

Last updated: Mar 29, 2026

Quick Overview

This question evaluates string-processing skills, combinatorial counting of substrings, simulation of time-based state changes, and algorithmic complexity analysis.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Find minimum time for irrecoverable password

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

A password is a string s of length n. A virus attacks positions in a 1-indexed order given by a permutation attackOrder[1..n]. At second t (1 <= t <= n), the character at position attackOrder[t] is replaced by a malicious character '*'. The password is irrecoverable once the number of substrings containing at least one '*' is >= m. Find the minimum time t after which the password becomes irrecoverable; if it is irrecoverable at the start, return 1. Implement findMinimumTime(password, attackOrder, m) and state the algorithm and its time and space complexity.

Quick Answer: This question evaluates string-processing skills, combinatorial counting of substrings, simulation of time-based state changes, and algorithmic complexity analysis.

Related Interview Questions

  • Implement Datacenter Router Commands - Amazon (hard)
  • Replace Delimited Tokens in a String - Amazon (medium)
  • Minimize Circular Redistribution Cost - Amazon (medium)
  • Find the Most Common Visit Pattern - Amazon (hard)
  • Maximize Value Under a Budget - Amazon (medium)
Amazon logo
Amazon
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
1
0

A password is a string s of length n. A virus attacks positions in a 1-indexed order given by a permutation attackOrder[1..n]. At second t (1 <= t <= n), the character at position attackOrder[t] is replaced by a malicious character ''. The password is irrecoverable once the number of substrings containing at least one '' is >= m. Find the minimum time t after which the password becomes irrecoverable; if it is irrecoverable at the start, return 1. Implement findMinimumTime(password, attackOrder, m) and state the algorithm and its time and space complexity.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.