PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Solve peak element and unique word abbreviation

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic design and data-structure skills by combining a binary-search peak-finding problem with a string-abbreviation uniqueness problem, testing competence in time-complexity reasoning and creation of minimal unique representations.

  • medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Solve peak element and unique word abbreviation

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given two independent coding problems to solve. 1) Peak element in an array (binary search) - Input: an integer array `nums` of length `n >= 1`. - A peak is an index `i` such that `nums[i] > nums[i-1]` and `nums[i] > nums[i+1]`. - Treat out-of-bounds neighbors as negative infinity: `nums[-1] = nums[n] = -∞`. - Task: return the index of any peak element. - Requirement: design an algorithm with `O(log n)` time. 2) Minimal unique abbreviations for a dictionary - Input: an array of distinct strings `words`. - A word can be abbreviated as: `prefix + <number of omitted middle characters> + last_char` (e.g., `"international" -> "i11l"`). - Abbreviations must be unique across the list. - If an abbreviation is not shorter than the original word, keep the original word. - Task: return an array `abbr` where `abbr[i]` is the minimal-length abbreviation for `words[i]` that is unique among all words. Clarify any assumptions you need (e.g., lowercase letters only) and implement the solutions.

Quick Answer: This question evaluates algorithmic design and data-structure skills by combining a binary-search peak-finding problem with a string-abbreviation uniqueness problem, testing competence in time-complexity reasoning and creation of minimal unique representations.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
Meta logo
Meta
Feb 6, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
1
0

You are given two independent coding problems to solve.

  1. Peak element in an array (binary search)
  • Input: an integer array nums of length n >= 1 .
  • A peak is an index i such that nums[i] > nums[i-1] and nums[i] > nums[i+1] .
  • Treat out-of-bounds neighbors as negative infinity: nums[-1] = nums[n] = -∞ .
  • Task: return the index of any peak element.
  • Requirement: design an algorithm with O(log n) time.
  1. Minimal unique abbreviations for a dictionary
  • Input: an array of distinct strings words .
  • A word can be abbreviated as: prefix + <number of omitted middle characters> + last_char (e.g., "international" -> "i11l" ).
  • Abbreviations must be unique across the list.
  • If an abbreviation is not shorter than the original word, keep the original word.
  • Task: return an array abbr where abbr[i] is the minimal-length abbreviation for words[i] that is unique among all words.

Clarify any assumptions you need (e.g., lowercase letters only) and implement the solutions.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.