Maximum Product of Three Numbers – LeetCode 628
Problem
Description
Given an integer array, find three numbers whose product is maximum and output the maximum product.
Answer
Original
Code
1 | class Solution { |
思路
直接排序然后针对负数情况进行处理。时间复杂度$O(nlog(n))$,空间复杂度$O(1)$。
耗时$44$ ms,排名$40.39\%$
Better
思路
还没看到更好的思路