LeeCode刷题
小弦的博客
这个作者很懒,什么都没留下…
展开
-
LeetCode刷题:1389.按给定顺序创建目标数组. Create Target Array in the Given Order
LeetCode刷题:1389.按给定顺序创建目标数组. Create Target Array in the Given Order 给定两个整数数组 nums和index。您的任务是根据以下规则创建目标数组: 最初目标数组为空。 从左到右读NUMS [i]和指数[I],插入在指数index[i] 的值nums[i] 在 目标阵列。 重复上述步骤,直到没有元素在阅读nums和index. 返回目标数组。 保证插入操作将是有效的。 范例1: 输入: nums = [0,1,2,3,4],索引= [0,1原创 2020-06-19 18:28:46 · 165 阅读 · 0 评论 -
LeetCode刷题:1464. 数组中两个元素的最大乘积.Maximum Product of Two Elements in an Array
LeetCode刷题:1464. 数组中两个元素的最大乘积 鉴于整数数组nums,你会选择两个不同的指数i和j数组的。返回的最大值 (nums[i]-1)*(nums[j]-1)。 范例1: 输入: nums = [3,4,5,2] 输出: 12 说明:如果选择索引i = 1和j = 2(从0开始索引),则将获得最大值,即(nums [1 ] -1)(数字[2] -1)=(4-1)(5-1)= 3 * 4 = 12。 范例2: 输入: nums = [1,5,4,5] 输出: 16 说明:选择索引i = 1原创 2020-06-18 14:56:09 · 145 阅读 · 0 评论