PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Roblox

Find target-heavy sliding windows

Last updated: Apr 26, 2026

Quick Overview

This question evaluates array manipulation, counting and efficient algorithm design—focusing on the sliding-window technique for detecting and quantifying target occurrences in fixed-size subarrays, and it measures algorithmic efficiency and complexity reasoning.

  • medium
  • Roblox
  • Coding & Algorithms
  • Machine Learning Engineer

Find target-heavy sliding windows

Company: Roblox

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Given an integer array `nums`, an integer `target`, and a fixed window size `k`, solve the following two tasks: 1. Return all contiguous subarrays of length `k` that contain at least one occurrence of `target`. 2. Among all contiguous subarrays of length `k`, return the first window that contains the maximum number of occurrences of `target`. If no length-`k` window contains `target`, return an empty list for part (1) and indicate that no valid window exists for part (2). Aim for an efficient sliding-window solution.

Quick Answer: This question evaluates array manipulation, counting and efficient algorithm design—focusing on the sliding-window technique for detecting and quantifying target occurrences in fixed-size subarrays, and it measures algorithmic efficiency and complexity reasoning.

Related Interview Questions

  • Find Windows Containing a Target - Roblox (medium)
  • Implement Sliding-Window Rate Limiter - Roblox (medium)
  • Find most frequent call path in logs - Roblox (medium)
  • Track Highest-Earning Experience - Roblox (medium)
  • Find the Most Frequent Log Call - Roblox (easy)
Roblox logo
Roblox
Feb 27, 2026, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
6
0
Loading...

Given an integer array nums, an integer target, and a fixed window size k, solve the following two tasks:

  1. Return all contiguous subarrays of length k that contain at least one occurrence of target .
  2. Among all contiguous subarrays of length k , return the first window that contains the maximum number of occurrences of target .

If no length-k window contains target, return an empty list for part (1) and indicate that no valid window exists for part (2).

Aim for an efficient sliding-window solution.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Roblox•More Machine Learning Engineer•Roblox Machine Learning Engineer•Roblox Coding & Algorithms•Machine Learning 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.