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 > Count Triangulars in a Range > Editorial

Count Triangulars in a Range — Solution & Editorial

Back to the Problem

Prefix counting: (how many ≤ R) − (how many ≤ L−1); the count-up-to function inverts the sequence's closed form (integer roots, bit length, or a precomputed list).

Complexity: O(1) or O(log)

Watch out: Everything must be exact integer arithmetic — floating-point roots drift at 1018.