当前位置:网站首页>Maximum product of three numbers in question 628 of Li Kou
Maximum product of three numbers in question 628 of Li Kou
2022-07-06 22:04:00 【Big chicken legs are best】
628. The maximum product of three numbers
The difficulty is simple 353 Switch to English to receive dynamic feedback
Here's an integer array nums , Find the largest product of three numbers in the array , And output this product .
Example 1:
Input :nums = [1,2,3] Output :6
Example 2:
Input :nums = [1,2,3,4] Output :24
Example 3:
Input :nums = [-1,-2,-3] Output :-6
/**
* @param {number[]} nums
* @return {number}
*/
var maximumProduct = function(nums) {
nums=nums.sort((a,b)=> {return a-b})
let len=nums.length-1
let l=nums[0]*nums[1]*nums[len]
let p=nums[len-2]*nums[len-1]*nums[len]
let c=Math.max(l,p)
return c
};
边栏推荐
- What is the RDD operator in spark
- What a new company needs to practice and pay attention to
- 一行代码可以做些什么?
- GPS从入门到放弃(二十)、天线偏移
- The relationship between root and coefficient of quadratic equation with one variable
- 【sciter Bug篇】多行隐藏
- GNN, please deepen your network layer~
- Write a rotation verification code annotation gadget with aardio
- Save and retrieve strings
- PostgreSQL modifies the password of the database user
猜你喜欢

GPS从入门到放弃(十七) 、对流层延时

Checkpoint of RDD in spark

2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks

关于程序员的职业操守,从《匠艺整洁之道》谈起
![[MySQL] online DDL details](/img/7e/97098d7ed5802c446bbadaf7035981.png)
[MySQL] online DDL details

GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)

Search element topic (DFS)

微信红包封面小程序源码-后台独立版-带测评积分功能源码

GNN,请你的网络层数再深一点~

美国科技行业结束黄金时代,芯片求售、裁员3万等哀声不断
随机推荐
基于LM317的可调直流电源
MariaDb数据库管理系统的学习(一)安装示意图
[Chongqing Guangdong education] Information Literacy of Sichuan Normal University: a new engine for efficiency improvement and lifelong learning reference materials
Why is the cluster mode of spark on Yan better than the client mode
11、 Service introduction and port
Bat script learning (I)
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
Some problems about the use of char[] array assignment through scanf..
PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
Problems in the process of opencv300 cmake generating project
美国科技行业结束黄金时代,芯片求售、裁员3万等哀声不断
Guava: use of multiset
1292_ Implementation analysis of vtask resume() and xtask resume fromisr() in freeros
HDU 2008 数字统计
Unity3d Learning Notes 6 - GPU instantiation (1)
[MySQL] online DDL details
What a new company needs to practice and pay attention to
Numpy download and installation
GPS from getting started to giving up (XX), antenna offset
Codeforces Round #274 (Div. 2) –A Expression