8.15day33

本文介绍了在LeetCode上遇到的三个编程题目,涉及贪心算法、队列操作、根据身高排序和最少数量箭引爆气球等技巧,旨在提升解题思路和代码实现能力。

5860. 柠檬水找零 - 力扣(LeetCode)

知识点:1.贪心:只要有十块钱零钱 就把十块钱花出去

             

问题:一刷思路不清晰









406. 根据身高重建队列 - 力扣(LeetCode)

知识点:1.通过lamba排序 如果身高相同就以k的升序排列 反之就用身高的降序排列

              2.以k为index对数组进行排序

 452. 用最少数量的箭引爆气球 - 力扣(LeetCode)

知识点:1.按照左边范围排序 要防止溢出

              2.判断是否可以一箭穿多个球 (else下边自增比较妙)

优化一下下面postgrepsql EXPLAIN ANALYSE SELECT a.regist_no as registNo, a.consult_flag as consultFlag, b.task_id as taskId, h.value as taskName, h.key as taskType, b.special_type as specialType, s.value as riskName, s.key as riskType, b.dispatcher_code as dispatcherCode, b.dispatcher_name as dispatcherName, a.surveyor_name as surveyorName, a.surveyor_tel as surveyorPhone, a.surveyor_code_confirm as surveyorCodeConfirm, a.surveyor_name_confirm as surveyorNameConfirm, (select onlineTeamName from (select online_team_name as onlineTeamName, regexp_split_to_table(city_comcodes, ',') as cityComcode FROM prp_online_group WHERE tab_type = '0') as d WHERE d.cityComcode = a.city_comcode) as onlineTeamName, to_char(a.insert_time_for_his, 'YYYY-MM-DD HH24:MI:SS') as influxStartDate, to_char(a.dispatch_datetime, 'YYYY-MM-DD HH24:MI:SS') as dispatchDate, b.dispatch_status as dispatchStatus, b.jzsh_dispatch_status as jzshDispatchStatus, a.city_comcode as cityComCode, a.license_no as licenseNo, a.task_status as taskStatus, a.surveyor_code as surveyorCode, a.province_comcode as provinceComCode FROM prp_car_surveyloginfo a LEFT JOIN tsk_car_taskinfo b ON a.task_id = b.task_id LEFT JOIN (select * from rul_system_param where type = 'tasktypecar') h on b.task_type = h.key LEFT JOIN (select * from rul_system_param where type = 'XLtype') s on b.risk_type = s.key WHERE b.manual_scheduling_type = '2' and a.province_comcode = '32000000' and a.insert_time_for_his >= '2023-03-09'::timestamp and a.insert_time_for_his <= '2025-08-01' ::timestamp + '1 day' and b.insurance_type = '0' ORDER BY a.insert_time_for_his desc 分析如下 INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES ('Nested Loop Left Join (cost=18.74..57455029860.83 rows=41898136 width=493) (actual time=2.042..20697.574 rows=21371 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Join Filter: ((b.risk_type)::text = (rul_system_param_1.key)::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Rows Removed by Join Filter: 128176'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Nested Loop Left Join (cost=14.42..12999619.58 rows=41898136 width=290) (actual time=1.829..18260.747 rows=21371 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Join Filter: ((b.task_type)::text = (rul_system_param.key)::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Rows Removed by Join Filter: 363652'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Nested Loop (cost=10.00..1687086.45 rows=41898136 width=262) (actual time=1.797..18175.874 rows=21371 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Merge Append (cost=10.00..44514.47 rows=159822 width=153) (actual time=0.359..315.942 rows=159903 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Sort Key: a.insert_time_for_his DESC'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Index Scan Backward using idx_prp_car_surveyloginfo_insert_time_for_his on prp_car_surveyloginfo a_1 (cost=0.12..8.15 rows=1 width=788) (actual time=0.011..0.011 rows=0 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Index Cond: ((insert_time_for_his >= ''2023-03-09 00:00:00''::timestamp without time zone) AND (insert_time_for_his <= ''2025-08-02 00:00:00''::timestamp without time zone))'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Filter: ((province_comcode)::text = ''32000000''::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Index Scan Backward using idx_prp_car_surveyloginfo_202212_insert_time_for_his on prp_car_surveyloginfo_202212 a_2 (cost=0.14..8.17 rows=1 width=116) (actual time=0.004..0.004 rows=0 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Index Cond: ((insert_time_for_his >= ''2023-03-09 00:00:00''::timestamp without time zone) AND (insert_time_for_his <= ''2025-08-02 00:00:00''::timestamp without time zone))'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Filter: ((province_comcode)::text = ''32000000''::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Index Scan Backward using idx_prp_car_surveyloginfo_202301_insert_time_for_his on prp_car_surveyloginfo_202301 a_3 (cost=0.28..8.30 rows=1 width=129) (actual time=0.003..0.003 rows=0 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Index Cond: ((insert_time_for_his >= ''2023-03-09 00:00:00''::timestamp without time zone) AND (insert_time_for_his <= ''2025-08-02 00:00:00''::timestamp without time zone))'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Filter: ((province_comcode)::text = ''32000000''::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Index Scan Backward using idx_prp_car_surveyloginfo_202302_insert_time_for_his on prp_car_surveyloginfo_202302 a_4 (cost=0.28..8.30 rows=1 width=129) (actual time=0.009..0.009 rows=0 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Index Cond: ((insert_time_for_his >= ''2023-03-09 00:00:00''::timestamp without time zone) AND (insert_time_for_his <= ''2025-08-02 00:00:00''::timestamp without time zone))'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Filter: ((province_comcode)::text = ''32000000''::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Index Scan Backward using idx_prp_car_surveyloginfo_202303_insert_time_for_his on prp_car_surveyloginfo_202303 a_5 (cost=0.28..1157.24 rows=2596 width=110) (actual time=0.015..4.715 rows=2453 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Index Cond: ((insert_time_for_his >= ''2023-03-09 00:00:00''::timestamp without time zone) AND (insert_time_for_his <= ''2025-08-02 00:00:00''::timestamp without time zone))'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Filter: ((province_comcode)::text = ''32000000''::text)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Rows Removed by Filter: 885'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' -> Index Scan Backward using idx_prp_car_surveyloginfo_202304_insert_time_for_his on prp_car_surveyloginfo_202304 a_6 (cost=0.28..1043.73 rows=2632 width=123) (actual time=0.010..5.241 rows=2632 loops=1)'); INSERT INTO "MY_TABLE"("QUERY PLAN") VALUES (' Index Cond: ((insert_time_for_his >= ''2023-03-09 00:00:00''::timestamp without time zone) AND (
07-23
### Filebeat 8.15 功能及使用说明 #### 安装指南 Filebeat 是 Elastic Stack 中的一个轻量级数据传输工具,用于收集日志并将其发送到 Elasticsearch 或 Logstash。对于 Windows 用户来说,可以通过下载安装包来完成部署[^3]。具体操作如下: 1. 访问官方文档页面获取最新版本的安装链接。 2. 下载完成后解压至目标目录。 针对 Mac OS X 用户,则可以采用命令行方式进行安装: ```bash curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.15.0-darwin-x86_64.tar.gz tar xzvf filebeat-8.15.0-darwin-x86_64.tar.gz ``` 上述脚本适用于 macOS 平台上的 Filebeat 部署过程[^4]。 #### 配置详解 为了使 Filebeat 正常工作,需对其进行适当配置。默认情况下,`filebeat.yml` 文件包含了所有的必要参数定义。以下是几个重要部分及其作用解释: - **输入源设定**:通过 `filebeat.inputs[]` 节点指定要监控的日志路径以及相应选项。例如启用 MySQL 日志模块前需要先加载该模块的相关规则集[^2]: ```yaml filebeat.modules: - module: mysql log: enabled: true ``` - **输出端口调整**:根据实际需求决定将采集的数据转发给哪个服务实例(Elasticsearch/Logstash)。下面展示了一个典型的指向本地运行 ES 实例的例子: ```yaml output.elasticsearch: hosts: ["http://localhost:9200"] ``` 更复杂的场景可能涉及字段映射或者条件过滤逻辑,在这种情形下建议查阅官方手册中的 filter 插件章节获得进一步指导[^5]。 #### 新增特性概述 随着版本迭代更新,Filebeat 不断引入新的特性和改进措施以满足日益增长的应用需求。在 v8.15 当中值得注意的变化有以下几个方面: - 支持多云环境下的无缝集成解决方案; - 增强了安全性机制,包括 TLS 加密通信和支持 OAuth2 协议认证等方式保障数据传输安全; - 提供更加灵活高效的资源配置手段简化运维管理流程; 以上内容综合反映了当前主流技术趋势的同时也体现了产品持续优化升级的决心与能力[^1]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值