PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/J.P. Morgan

Compute ring window max and deletion indices

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving across arrays and strings, covering concepts such as sliding-window techniques on circular arrays, wraparound handling, index recovery after single-character deletion, duplicate-character considerations, and time/space complexity analysis within the Coding & Algorithms domain.

  • Medium
  • J.P. Morgan
  • Coding & Algorithms
  • Software Engineer

Compute ring window max and deletion indices

Company: J.P. Morgan

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Part A — Ring window maximum: You are given n computers arranged in a circle, represented by an array of bits (1 = on, 0 = off), and an integer k (1 <= k <= n). What is the maximum number of on computers within any k consecutive positions along the ring (wrapping allowed)? Describe an algorithm and analyze its time and space complexity. Part B — Deletion index recovery: You are given two strings s1 and s2 such that s2 can be obtained from s1 by deleting exactly one character (i.e., |s1| = |s2| + 1). Return all 0-based indices i in s1 such that removing s1[i] yields s2. Provide the algorithm and its complexity, and explain how you handle repeated characters and edge cases.

Quick Answer: This question evaluates algorithmic problem-solving across arrays and strings, covering concepts such as sliding-window techniques on circular arrays, wraparound handling, index recovery after single-character deletion, duplicate-character considerations, and time/space complexity analysis within the Coding & Algorithms domain.

Related Interview Questions

  • Implement Integer Square Root - J.P. Morgan (medium)
  • Implement KNN from Scratch - J.P. Morgan (medium)
  • Minimize Operations to Balance Shipments - J.P. Morgan (medium)
  • Solve scheduling and collision problems - J.P. Morgan (medium)
  • Design an autocomplete suggestions API - J.P. Morgan (easy)
J.P. Morgan logo
J.P. Morgan
Jul 31, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0

Part A — Ring window maximum: You are given n computers arranged in a circle, represented by an array of bits (1 = on, 0 = off), and an integer k (1 <= k <= n). What is the maximum number of on computers within any k consecutive positions along the ring (wrapping allowed)? Describe an algorithm and analyze its time and space complexity.

Part B — Deletion index recovery: You are given two strings s1 and s2 such that s2 can be obtained from s1 by deleting exactly one character (i.e., |s1| = |s2| + 1). Return all 0-based indices i in s1 such that removing s1[i] yields s2. Provide the algorithm and its complexity, and explain how you handle repeated characters and edge cases.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More J.P. Morgan•More Software Engineer•J.P. Morgan Software Engineer•J.P. Morgan 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.