当前位置:网站首页>【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
2022-04-23 18:06:00 【CashAp】
455. 分发饼干
1 贪心
- 如何处理同一块饼干喂给多个小孩的问题?
(使用数组下标,饼干使用过之后,饼干数组的下标就--
,即后面使用数组中的前一块饼干) - 饼干少于孩子个数,如何处理饼干数组指针越界问题?
使用饼干数组有元素时(index >= 0
),才把饼干给小孩
if (index >= 0 && s[index
版权声明
本文为[CashAp]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_60225495/article/details/124363083
边栏推荐
- C language array processing batch data
- String function in MySQL
- 由tcl脚本生成板子对应的vivado工程
- Crawler for querying nicknames and avatars based on qqwebapi
- ArcGIS license error -15 solution
- Crack sliding verification code
- Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
- idea中安装YapiUpload 插件将api接口上传到yapi文档上
- 2022 Jiangxi energy storage technology exhibition, China Battery exhibition, power battery exhibition and fuel cell Exhibition
- [UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
猜你喜欢
.104History
2022江西储能技术展会,中国电池展,动力电池展,燃料电池展
Logic regression principle and code implementation
Calculation of fishing net road density
Implementation of image recognition code based on VGg convolutional neural network
Clion installation tutorial
Transfer learning of five categories of pictures based on VGg
Scikit learn sklearn 0.18 official document Chinese version
.105Location
Process management command
随机推荐
Rewrite four functions such as StrCmp in C language
纳米技术+AI赋能蛋白质组学|珞米生命科技完成近千万美元融资
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
Pointers in rust: box, RC, cell, refcell
Re regular expression
ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
Auto.js 自定义对话框
Auto. JS custom dialog box
C#的随机数生成
Batch export ArcGIS attribute table
GDAL + ogr learning
Selenium + phantom JS crack sliding verification 2
Arcpy adds fields and loop assignments to vector data
Multi thread crawling Marco Polo network supplier data
NVIDIA Jetson: GStreamer and openmax (GST OMX) plug-ins
Calculation of fishing net road density
Multi thread safe reference arc of rust
Transfer learning of five categories of pictures based on VGg
String function in MySQL