Click here to see the full article post
For Brute Force, do we really need 3 loop?
To get a * a+b * b+c * c smallest, we can make sure a, b, c itself is the smallest.
So we can lower the complexity from O(16 * 16 * 16) to O(3 * 16).
Yes, both are O(1). But the latter one looks better.
q = q / 17 + (q % 17 > 8 ? 1 : 0); want to know how this method work to find out which color component will be used? Thanks
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.