MCPcopy Create free account
hub / github.com/Flamewaker/JavaPersonalSummary / ByteDance02

Class ByteDance02

Code/exam/ByteDance02.java:23–69  ·  view source on GitHub ↗

@author todd @date 2020/6/25 10:41 @description: 头条校招 一场考试包含3道开放性题目,假设他们的难度从小到大分别为a,b,c,我们希望这3道题能满足下列条件: a<=b<=c b-a<=10 c-b<=10 所有出题人一共出了n道开放性题目。现在我们想把这n道题分布到若干场考试中,计算出我们最少还需要再出几道题吗? 滑动窗口O(n) 3个一组分4种情况 先从小到大排个序 O(nlogn) 下标永远指向第一个数 第1种: 这三个都满足要求 下标直接+3 第2种: 第二个比第一个大超过20 那么第一个后面添加2个数 下标+1 第3种:第二个比第一

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected