Can you help with more details on choosing this algorithm and a brute force approach too for array of products?