RigUp Interview Question

Prime numbers, pivot array, SQL problem