โ† Amazon questions
CodingHard

Subsequence Modulo Problem

Filed under Amazon

Free read 2 of 3

Confirm how the modulo operation is applied to the formed subsequence and what constitutes a valid K-digit number.

The question

Given an array of integers and a number K, find and count all subsequences that form a valid K-digit number after applying a modulo operation.

Constraints

  • Array elements can be positive integers.
  • K represents the expected digit length of the resulting number.
  • Results may need to be returned modulo 10^9 + 7 due to large counts.

Approach

  1. Confirm how the modulo operation is applied to the formed subsequence and what constitutes a valid K-digit number.

Tips

  • What they are testing: Test with small arrays where subsequences can be manually verified, and edge values of K.
  • Common mistake: Confusing subsequences (not necessarily contiguous) with subarrays (contiguous).

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.