当前位置:网站首页>【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
边栏推荐
- Go language JSON package usage
- JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
- Format problems encountered in word typesetting
- journal
- Crawler for querying nicknames and avatars based on qqwebapi
- Classes and objects
- Batch export ArcGIS attribute table
- MySQL_ 01_ Simple data retrieval
- I/O多路复用及其相关详解
- undefined reference to `Nabo::NearestNeighbourSearch
猜你喜欢
Summary of floating point double precision, single precision and half precision knowledge
Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
Laser slam theory and practice of dark blue College Chapter 3 laser radar distortion removal exercise
MySQL auto start settings start with systemctl start mysqld
Go file operation
Eigen learning summary
Docker 安裝 Redis
Go语言JSON包使用
Robocode tutorial 3 - Robo machine analysis
String function in MySQL
随机推荐
Mode of interprocess communication
Yolov4 pruning [with code]
Auto.js 自定义对话框
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
journal
From source code to executable file
2022 Jiangxi energy storage technology exhibition, China Battery exhibition, power battery exhibition and fuel cell Exhibition
Gobang game based on pyGame Library
Rust: how to match a string?
Random number generation of C #
Cells in rust share variable pointers
Batch export ArcGIS attribute table
Selenium + webdriver + chrome realize Baidu to search for pictures
MySQL 中的字符串函数
Visualization of residential house prices
.104History
Tensorflow tensor introduction
MySQL_ 01_ Simple data retrieval
ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
Read excel, int digital time to time