← 返回 bytedance 的题目列表Egg Drop + 3Sum
类型:online_judge
This round included two coding questions:
Egg Drop
Given k eggs and n floors, you may drop an egg from any floor each move:
If it breaks, the critical floor is below that floor.
If it doesn’t, the critical floor is at or above that floor.
Return the minimum number of moves required to determine the critical floor in the worst case.
3Sum
Given an integer array nums, find all unique triplets (a,b,c) such that a + b + c = 0.
Return all unique triplets.
Constraints
Egg Drop: 1 <= k <= 100, 0 <= n <= 1e4 (or similar scale).
3Sum: 1 <= len(nums) <= 3e3 (or similar scale).
Notes
For 3Sum, each triplet should be non-decreasing; output order doesn’t matter.
Example
Input
2 6
Output
3