leetcode628】的更多相关文章

Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6  Example 2: Input: [1,2,3,4] Output: 24  Note: The length of the given array will be in range [3,104] and all elem…
这道题十分不容易啊,做到半夜. class Solution { public: static int cmp628(int a, int b) { return a > b; } static int cmp628_2(int a, int b) { return abs(a) < abs(b); } int maximumProduct(vector<int>& nums) { ; int Pos[N]; int Nag[N]; int Nor[N]; , j = ,…
给定一个整型数组,在数组中找出由三个数组成的最大乘积,并输出这个乘积. 示例 1: 输入: [1,2,3] 输出: 6 示例 2: 输入: [1,2,3,4] 输出: 24 注意: 给定的整型数组长度范围是[3,104],数组中所有的元素范围是[-1000, 1000]. 输入的数组中任意三个数的乘积不会超出32位有符号整数的范围. bool cmp(int x, int y) { return x > y; } class Solution { public: int maximumProdu…