valuation improvment O(n²) => O(n)