首页 存档 技术 查看内容

每周算法推送(1)

2018-3-30 13:00 |来自: 互联网 290 0

摘要: 1每周算法推送(1)1推送说明本推送每周一期,推送一道算法题目,所选题目均来自leetcode在线评测网站,并会在推送中给出该题的链接,完成题目的同学可以到提供的链接网页中提交并察看结果。推送内容采用以下方式:除 ...

1

每周算法推送(1)

1

推送说明


本推送每周一期,推送一道算法题目,所选题目均来自leetcode在线评测网站,并会在推送中给出该题的链接,完成题目的同学可以到提供的链接网页中提交并察看结果。


推送内容采用以下方式:除第一期外,每周的推送内容为上一期的题目分析和(C )代码参考答案,并推出本期的题目。

本期题目


leetcode 312

Butst Balloons


题目描述

Givennballoons, indexed from0ton-1. Each balloon is painted with a number on it represented by arraynums. You are asked to burst all the balloons. If the you burst ballooniyou will getnums[left] * nums[i] * nums[right]coins. Hereleftandrightare adjacent indices ofi. After the burst, theleftandrightthen becomes adjacent.


Find the maximum coins you can collect by bursting the balloons wisely.


Note:


(1) You may imaginenums[-1] = nums[n] = 1. They are not real therefore you can not burst them.


(2) 0 ≤n≤ 500, 0 ≤nums[i]≤ 100


Example :


Given[3, 1, 5, 8]

Return167


nums = [3,1,5,8] --

声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

相关分类

返回顶部