Rob Houses Without Getting Caught

Problem Overview

  • Count the number of ways to rob exactly y houses from n so the total travel distance is a multiple of x.
  • Inputs: n (houses), y (to rob), x (divisibility), and array a where a[i] gives the distance between two houses; you can start anywhere and cannot rob the same house twice.
  • Output: total valid plans (ways) that meet the distance rule without getting caught.
  • Real-world context: planning robber routes; Epam interviews coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: