← 返回 twosigma 的题目列表Palindrome Warmup + Two-Task Worker Scheduling
类型:qbank
QR onsite coding round: start with palindrome checks, then generate the smallest palindrome greater than K, then reason verbally about assigning 2n workers across two tasks to minimize total time.
Requirements
Reported sequence:
Warm-up: determine whether a number is a palindrome.
Given a number K, return the smallest palindrome number greater than K.
Verbal algorithm question: given 2n workers and two tasks, arrange assignments to minimize total time.
Notes
The first two parts are concrete coding; the third was described without enough input details to pin down the exact objective, so clarify whether each worker has two task durations, whether each task needs n workers, and whether the objective is makespan or sum of completion times.
For the next-palindrome task, mirror the left half, compare with K, and increment the middle / left half if the mirrored candidate is not greater.
Edge cases: all 9s, even vs odd length, leading carry, and input already palindromic.
Preparation
Implement next-palindrome for strings so very large numbers do not overflow.
Drill edge cases: 9, 99, 12932, 12321, 1991.
Prepare a clarification-first answer for the worker scheduling follow-up before naming greedy or DP.