当前位置:首页|资讯

leetcode904水果成篮

作者:李子不恰糖心蛋发布时间:2024-09-19

class Solution { public:     int totalFruit(vector& fruits) {         //是需要判断元素是不是在容器里面,且容器里面的元素的类型不可以超过2种,所以要用哈希表(因为不确实数组的大小,而且要返回水果的数目)         //key是水果的种类,value是水果的数目         unordered_map backet;         int maxNum=0;         int start=0...【查看原文】


Copyright © 2024 aigcdaily.cn  北京智识时代科技有限公司  版权所有  京ICP备2023006237号-1