Evaluate Indexed Arithmetic Equations
Updated
Problem statement
The four arrays are aligned. At index i, apply operator +, -, *, or / to left[i] and right[i], and report whether the exact mathematical result equals expected[i].
Division by zero is false. Division is true only when the quotient is an integer equal to expected.
Function
evaluateEquations(left: int[], right: int[], expected: int[], operators: String[]) → boolean[]Examples
Example 1
left = [2,5,3,8]right = [3,2,4,2]expected = [5,3,12,4]operators = ["+","-","*","/"]return = [true,true,true,true]Each supported operation evaluates true.
Example 2
left = [1,2]right = [1,2]expected = [3,5]operators = ["+","*"]return = [false,false]Incorrect expected values return false.
Constraints
0 <= left.length <= 100000- All arrays have equal length; integer values are in
[-10000,10000].
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Book Reading EveningsGoogle · OAGoogle interview questions
- Basic Item DiscountsPalantir · OAPalantir interview questions
- Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
- Lift Total TravelInfosys · OAInfosys interview questions
- Shell Command Counts with History ReferencesTikTok · OATikTok interview questions
- Count Dropped RequestsJP Morgan Chase · OAJP Morgan Chase interview questions
- Recursively Expanded Shell Command CountsHudson River Trading · OAHudson River Trading interview questions
- Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
- First Value Below Both NeighborsCapital One · OACapital One interview questions