TikTok Interview Question

Divide and conquer algorithm question in Python.