← Eightfold AI Interview Insights

Eightfold AI·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Had a technical screen at Eightfold AI for a software engineer role. One coding problem, binary search flavor, nothing too exotic but it required knowing the pattern cold.

Questions Asked (1)

Q1

Given n piles of bananas and h hours before the guards return, find the minimum eating speed k such that Koko can finish all the bananas in time. Each hour she picks one pile and eats up to k bananas from it.

Algorithms & Data Structures
Author's notes

Classic binary search on the answer problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Recognize that the minimum eating speed k can be found using binary search on the answer space from 1 to max(piles). For each candidate speed, simulate the total hours needed and adjust the search range based on whether it's feasible within h hours.

Pro tip: Clearly state the time complexity O(n log m) where m is the maximum pile size, and mention that the simulation uses integer division with ceiling to compute hours per pile. This shows you understand both the algorithm and its efficiency.

1. Define the search space

The minimum possible speed is 1 (if h is large enough) and the maximum needed is max(piles) because eating faster than the largest pile doesn't reduce hours further.

2. Binary search for k

While low <= high, pick mid = (low+high)//2. Check if Koko can finish all piles within h hours at speed mid.

3. Feasibility check

For a given speed k, compute total hours as sum(ceil(pile/k) for pile in piles). If total <= h, then k is feasible; otherwise not.

4. Adjust search bounds

If feasible, record k as a candidate and move high = mid - 1 to find a smaller valid speed. If not, move low = mid + 1.

5. Return the minimum k

After the loop, low will be the smallest feasible speed. Return low.

Key Points to Mention

  • Binary search on the answer space (speed) rather than on the piles.
  • Feasibility function: total hours = sum(ceil(pile / k)).
  • Time complexity: O(n log m) where n is number of piles and m is max pile size.
  • Space complexity: O(1) extra space.
  • Edge cases: h < n (impossible), h >= sum(piles) (k=1), and large pile sizes.
  • Use integer arithmetic to avoid floating-point precision issues: ceil(pile/k) = (pile + k - 1) // k.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.