Solve prefix, array, and string problems
Company: Pinterest
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
The interview included several coding problems:
1. **First index matching a prefix**: Given a sorted array of lowercase strings such as `["a", "apple", "appz", "b"]` and a prefix such as `"ap"`, return the index of the first word that starts with the prefix. If no word matches, return `-1`.
2. **Maximum rectangle from bar heights**: Given an array of non-negative integers representing adjacent bar heights, where each bar has width `1`, return the maximum rectangular area that can be formed using one or more consecutive bars.
3. **Check ordered deletion match**: Given two strings `s` and `t`, determine whether `s` can be formed by deleting some characters from `t` without changing the order of the remaining characters.
Quick Answer: This set of problems evaluates proficiency in string and array algorithm design—covering prefix search, subsequence matching, and maximal-area computation from bar heights—measuring competence in algorithmic thinking, data structure usage, and time/space efficiency.