PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Solve windowed duplicates and target expression

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in windowed duplicate detection and time-space trade-offs for streaming or bounded-range scans, along with combinatorial expression generation and on-the-fly numeric evaluation using search, reflecting skills in algorithm design, data-structure selection, and numeric correctness.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Solve windowed duplicates and target expression

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

1) Windowed duplicate check: Given an integer array nums and an integer k, determine whether there exist indices i and j such that nums[i] == nums[j] and |i - j| <= k. If such pairs exist, also return the minimum index gap among them. Design an O(n) time solution that uses at most O(k) extra space. Explain how to evict stale entries while scanning (e.g., hash map plus queue or a moving front pointer), and analyze the time/space trade-offs. Provide code and complexity analysis. 2) Target expression from 1..9: Given the string "123456789" (digits 1 through 9 in order) and a target integer T, insert between digits either '+', '-', or nothing (concatenation). You may also place a leading '+' or '-' before the first digit. Determine if any resulting expression evaluates to T; if so, return one valid expression (or all). Implement a DFS/backtracking approach that builds expressions and evaluates them on the fly (without reparsing), handles concatenation, avoids leading-zero numbers, discusses pruning strategies and complexity, and addresses integer-overflow considerations.

Quick Answer: This question evaluates proficiency in windowed duplicate detection and time-space trade-offs for streaming or bounded-range scans, along with combinatorial expression generation and on-the-fly numeric evaluation using search, reflecting skills in algorithm design, data-structure selection, and numeric correctness.

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
Aug 13, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
  1. Windowed duplicate check: Given an integer array nums and an integer k, determine whether there exist indices i and j such that nums[i] == nums[j] and |i - j| <= k. If such pairs exist, also return the minimum index gap among them. Design an O(n) time solution that uses at most O(k) extra space. Explain how to evict stale entries while scanning (e.g., hash map plus queue or a moving front pointer), and analyze the time/space trade-offs. Provide code and complexity analysis.
  2. Target expression from 1..9: Given the string "123456789" (digits 1 through 9 in order) and a target integer T, insert between digits either '+', '-', or nothing (concatenation). You may also place a leading '+' or '-' before the first digit. Determine if any resulting expression evaluates to T; if so, return one valid expression (or all). Implement a DFS/backtracking approach that builds expressions and evaluates them on the fly (without reparsing), handles concatenation, avoids leading-zero numbers, discusses pruning strategies and complexity, and addresses integer-overflow considerations.

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.