Leetcode 第191场周赛题解

5424. 数组中两元素的最大乘积 知识点 时间复杂度 暴力枚举 O(n) 从 1 到 n-1 枚举,计算 (nums[i]-1)*(nums[i-1]-1) 。并记录最大值。web class Solution { public: int maxProduct(vector<int>& nums) { int anw = 0; for(int i = 0;
相关文章
相关标签/搜索