Minimum Distance Between People and Cakes
Asked at Google · Coding & Leetcode-style Questions · Difficulty: Medium
Write a method to return the minimum distance between any person and any cake. Inputs are two arrays: one integer array representing people's positions and another representing cakes' positions. Both arrays are sorted in ascending order. Output an integer indicating the minimum distance. Assume people and cakes are on the same dimension. Implement a solution with O(N) time complexity.
Loading the problem…
More Google interview questions
- LLM conceptual questions
- Implement a Nested Tic-Tac-Toe Game Engine
- ML Fundamentals Deep Dive (AI/ML & MLE Roles)
- ML System Design: Recsys, Chatbot, Image Classifier
- ML Coding: Implement a Simple Attention / Layer Forward Pass
- Longest-Match Greedy Tokenization with Dictionary ID Replacement