Find Arrangements

Problem Overview

  • Compute the number of valid schedules arranging P hours of Physics and C hours of Chemistry so no subject exceeds N consecutive hours.
  • Input: T test cases with integers P, C, N. Output: count of arrangements modulo 1e9+7; print 0 if none.
  • Constraints: 1 ≤ T ≤ 100; 1 ≤ P, C, N ≤ 10^3.
  • Context: school timetable planning to limit continuous teaching and reduce fatigue.
  • From IBM interviews; a 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: