2.刚想了个可能更简单的解法(请大佬指教) 双指针 一开始l和r都指向1所在的位置,然后依次往外扩。比如2的位置比l小就让2的位置为l,比r大就让r为2的位置。依次往下扩,如果正好在l,r区间内就不动。如果n的值正好等于区间长度就让计数器加1
5 2

相关推荐

牛6666666__:select f.farm_name as farm_name, c.crop_name, c.crop_type, round(avg(health_index), 2) as avg_health_index, round(sum(yield_kg_per_hectare),0) as avg_yield_kg_per_hectare, datediff(max(measurement_date), min(planting_date)) as growth_days from crop_data cd inner join farms f on cd.farm_id = f.farm_id inner join crops c on cd.crop_id = c.crop_id where cd.measurement_date between '2024-03-01' and '2024-06-30' group by cd.crop_id, cd.farm_id,f.farm_name having count(cd.data_id) >= 3 order by avg_health_index desc, avg_yield_kg_per_hectare desc,farm_name
投递恒生电子股份有限公司等公司10个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务