Quick Overview

Given numbers in a fixed order and a target, insert +, - or * between them and add parentheses to reach the target, returning the lexicographically smallest fully parenthesized expression or an empty string. Starts with three numbers and generalizes to n, testing exhaustive search over expression trees.

Insert +, -, * and Parentheses Between Ordered Numbers to Reach a Target

Company: Waymo

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Overview: Given numbers in a fixed order and a target, insert +, - or * between them and add parentheses to reach the target, returning the lexicographically smallest fully parenthesized expression or an empty string. Starts with three numbers and generalizes to n, testing exhaustive search over expression trees.

Loading…