Minimum Universal Derivative Order
Updated
Problem statement
For this exercise, assume the fixed divisor in a polynomial question is generalized to the positive integer divisor supplied as input.
For a polynomial P, write P^(order) for its orderth derivative, not an ordinary power. The value P^(order)(k) is that derivative evaluated at the integer k.
Return the smallest positive integer order such that P^(order)(k) is divisible by divisor for every polynomial with integer coefficients and every integer k.
No particular polynomial is supplied, and polynomial degree is unrestricted. Constant polynomials and negative or zero integer evaluation points are included. Divisibility of zero follows the usual integer definition.
Complete smallestUniversalDerivativeOrder(divisor) and return the exact integer order. The order must remain positive when divisor = 1.
Function
smallestUniversalDerivativeOrder(divisor: int) → intExamples
Example 1
divisor = 2021return = 47The source instance has 2021 = 43 * 47. An order below 47 misses the factor 47 in its factorial, while 47! contains both 43 and 47.
Example 2
divisor = 1return = 1Every integer is divisible by 1. The required derivative order is positive, so its minimum is 1.
Example 3
divisor = 8return = 4Three powers of 2 are needed. 3! = 6 is insufficient, while 4! = 24 is divisible by 8.
Constraints
- For this exercise, assume
1 <= divisor <= 10^6. - The least positive valid order is at most
divisor, so the return value fits a signed 32-bit integer. - Use a wide integer before multiplying factorial residues; a reduced residue times an order can approach
10^12.
More IMC Trading Online Assessment questions
- Earliest Meeting Start on a 24-Hour ClockOA · Seen Nov 2026
- Grid Paths with Override PassesOA · Seen Oct 2026
- Weighted LFU CacheOA · Seen Sep 2026
- Rock JumpingOA · Seen Aug 2026
- Stack Batch RemovalOA · Seen Aug 2026
- Chain of CommandOA · Seen Aug 2026
- Choose ContainersOA · Seen Aug 2026
- Sub-matrix SumsOA · Seen Jul 2026
- Sub-matrix SumsOA · Seen Jul 2026
- Can Every Package Fit in a BoxOA · Seen Jul 2026
Similar questions at other companies
- Count Distinct Arrays After Decrement OperationsBloomberg LP · OABloomberg LP interview questions
- Polynomial CoefficientsShopify · OAShopify interview questions
- Basic Calculator IITypeSafe AI · OA
- Last Object to Fall Off the TableConfluent · OAConfluent interview questions
- Last Object Exit TimeIBM · OAIBM interview questions
- Count Prime Values in SubtreesVisa · OAVisa interview questions
- Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
- Server Upgrade PlanningWells Fargo · OAWells Fargo interview questions
- Capping Portfolio WeightsCapstone Investment Advisors · OA
- Gaussian Naive Bayes Classifier (Machine Learning OA)Pinterest · OAPinterest interview questions