![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
双指针
dezhonger
这个作者很懒,什么都没留下…
展开
-
Leetcode 948
可以话费power得到point,可以用point来得到一个token的power。 问可以选取到的最大point 一个显然的策略是:用小的power得到point,再用point取换取大的power,这样就可以买到更多的point的,具体实现可以使用双指针。 public int bagOfTokensScore(int[] tokens, int P) { ...原创 2020-01-26 02:17:28 · 188 阅读 · 1 评论 -
Leetcode904 Fruit Into Baskets
https://leetcode.com/problems/fruit-into-baskets/ 选取最大长度的子数组,只包含两种值。 做法:双指针 public int totalFruit(int[] tree) { int[] cnt = new int[40010]; int l = 0; int type...原创 2019-07-17 19:52:56 · 101 阅读 · 0 评论