当前位置:网站首页>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
};
边栏推荐
- Reset Mikrotik Routeros using netinstall
- GPS从入门到放弃(十九)、精密星历(sp3格式)
- 1D convolution detail
- Oracle Performance Analysis 3: introduction to tkprof
- Checkpoint of RDD in spark
- 【MySQL】Online DDL详解
- Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
- GPS从入门到放弃(十八)、多路径效应
- Michael smashed the minority milk sign
- Mysql相关术语
猜你喜欢

Uni app app half screen continuous code scanning

【MySQL】Online DDL详解

Why is the cluster mode of spark on Yan better than the client mode

Checkpoint of RDD in spark
![[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference](/img/61/976c7d86ab3b2df5f5af3beefbf547.png)
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference

Sparkshuffle process and Mr shuffle process

PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology

GPS从入门到放弃(十二)、 多普勒定速
![Happy sound 2[sing.2]](/img/ca/1581e561c427cb5b9bd5ae2604b993.jpg)
Happy sound 2[sing.2]

爬虫实战(五):爬豆瓣top250
随机推荐
LeetCode学习记录(从新手村出发之杀不出新手村)----1
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
Oracle Performance Analysis 3: introduction to tkprof
What can one line of code do?
新入职一家公司需要去实践和注意的内容
PostgreSQL 修改数据库用户的密码
Aggregate function with key in spark
GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
uni-app App端半屏连续扫码
What about the spectrogram
一行代码可以做些什么?
Realization of epoll reactor model
Unity3d Learning Notes 6 - GPU instantiation (1)
JPEG2000-Matlab源码实现
GNN, please deepen your network layer~
Univariate cubic equation - relationship between root and coefficient
关于char[]数组通过scanf赋值使用上的一些问题。。
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
GPS从入门到放弃(十四)、电离层延时
High precision face recognition based on insightface, which can directly benchmark hongruan