Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > System of Remainders > Editorial

System of Remainders — Solution & Editorial

Back to the Problem

Merge congruences pairwise with the general CRT: a solution to x≡r0 (mod m0) and x≡ri (mod mi) exists iff gcd(m0, mi) divides (ri − r0); combine into a single congruence modulo lcm(m0, mi).

Complexity: O(K log)

Watch out: Non-coprime moduli — the divisibility feasibility check is where naive CRT silently produces garbage.