Locate a Local Maximum in an Array
Asked at Meta · Coding Questions · Difficulty: Hard
Given a list of numbers in which no two neighbours are equal, return the position of any element that is larger than both of its neighbours. The list is treated as if it were surrounded by negative infinity, so the first and last elements only need to beat their single real neighbour. The catch is speed: you may read only about two elements per halving of the search range, so the budget in Rule 3 is tight.
Loading the problem…
More Meta interview questions
- LLM conceptual questions
- Implement a Two-Hidden-Layer MLP with Backpropagation in NumPy
- Dot Product with Run-Length Encoded Vectors
- Count Lakes Wrapped by a Given Island
- Minimum Remove to Make Valid Parentheses
- LLM with Beam Search and Nucleus Sampling (Meta MSL)