PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Snapchat

Determine and print expression to reach target

Last updated: Mar 29, 2026

Quick Overview

This question evaluates skill in constructing and evaluating arithmetic expressions, handling numerical stability (including division-by-zero and floating-point tolerance), and reasoning about combinatorial permutations of numbers and operators.

  • Medium
  • Snapchat
  • Coding & Algorithms
  • Machine Learning Engineer

Determine and print expression to reach target

Company: Snapchat

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

You are given four numbers and a target T (e.g., 24). Using +, −, ×, ÷ and parentheses, and using each number exactly once, determine whether you can form an expression that evaluates to T. Return a boolean. Follow-up: if it is possible, output one valid expression string. Clarify how to handle division by zero and floating-point tolerance; discuss algorithmic approach (e.g., backtracking with pruning), complexity, and how you would extend the method to N numbers or different operator sets.

Quick Answer: This question evaluates skill in constructing and evaluating arithmetic expressions, handling numerical stability (including division-by-zero and floating-point tolerance), and reasoning about combinatorial permutations of numbers and operators.

Related Interview Questions

  • Determine Whether Courses Can Be Completed - Snapchat (medium)
  • Solve Decimal Coin Change - Snapchat (medium)
  • Find Maximum Island Perimeter - Snapchat (medium)
  • Solve Three Algorithmic Tasks - Snapchat (hard)
  • Implement a Timestamped Counter - Snapchat (medium)
Snapchat logo
Snapchat
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
3
0

You are given four numbers and a target T (e.g., 24). Using +, −, ×, ÷ and parentheses, and using each number exactly once, determine whether you can form an expression that evaluates to T. Return a boolean. Follow-up: if it is possible, output one valid expression string. Clarify how to handle division by zero and floating-point tolerance; discuss algorithmic approach (e.g., backtracking with pruning), complexity, and how you would extend the method to N numbers or different operator sets.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snapchat•More Machine Learning Engineer•Snapchat Machine Learning Engineer•Snapchat Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,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.