MongoDB Interview Question

How to square integers in array and keep it sorted