leetcode_464. Can I Win ? 待解决
来源:互联网 发布:淘宝开代购店 编辑:程序博客网 时间:2024/06/01 19:00
In the “100 game,” two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins.
What if we change the game so that players cannot re-use integers?
For example, two players might take turns drawing from a common pool of numbers of 1..15 without replacement until they reach a total >= 100.
Given an integer maxChoosableInteger and another integer desiredTotal, determine if the first player to move can force a win, assuming both players play optimally.
You can always assume that maxChoosableInteger will not be larger than 20 and desiredTotal will not be larger than 300.
Example
Input:
maxChoosableInteger = 10
desiredTotal = 11
Output:
false
Explanation:
No matter which integer the first player choose, the first player will lose.
The first player can choose an integer from 1 up to 10.
If the first player choose 1, the second player can only choose integers from 2 up to 10.
The second player will win by choosing 10 and get a total = 11, which is >= desiredTotal.
Same with other integers chosen by the first player, the second player will always win.
提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢
历史题目和总结见公众号「每日一道算法题」
https://leetcode.com/problems/can-i-win/description/
思路:
- leetcode_464. Can I Win ? 待解决
- leetcode_464. Can I Win ? 待解决
- 464. Can I Win
- [LeetCode]Can I Win
- Can I Win
- 464. Can I Win
- 464. Can I Win**
- 464. Can I Win
- 464. Can I Win
- LeetCode13 Can I win
- [LeetCode] Can I Win
- 464. Can I Win
- 464. Can I Win
- [leetcode 464]Can I Win
- Leetcode-464. Can I Win
- LeetCode 464. Can I Win
- 464. Can I Win -Medium
- [leetcode]464. Can I Win
- nyoj722 数独
- Could not autowire. No beans of 'xxxMapper' type found.
- 单片机莫名掉电
- ghkdfhdj
- 2 微服务实战系列
- leetcode_464. Can I Win ? 待解决
- ionic创建APP步骤:
- Linux下which、whereis、locate、find 命令的区别
- JCAOB---Java文本转语音
- 031day(STL排序算法sort)
- node上传图片重命名及添加后缀
- 面试题22:栈的压入、弹出序列
- ElasticSearch5.X添加度量聚合(二)
- 仿淘宝首页的淘宝头条垂直滚动