PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Oracle

Find shortest subarray meeting target sum

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competence in array-based algorithm design, handling of negative values and contiguous subarray sums, and rigorous time and space complexity analysis.

  • Medium
  • Oracle
  • Coding & Algorithms
  • Software Engineer

Find shortest subarray meeting target sum

Company: Oracle

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Given an integer array nums (values may be negative) and an integer T, return the length of the shortest non-empty contiguous subarray whose sum is at least T; return -1 if no such subarray exists. Optimize for n up to 200,000. Explain your approach, prove its correctness, analyze time and space complexity, and implement an O(n) solution.

Quick Answer: This question evaluates a candidate's competence in array-based algorithm design, handling of negative values and contiguous subarray sums, and rigorous time and space complexity analysis.

Related Interview Questions

  • Solve Five Coding Problems - Oracle (medium)
  • Compute letter frequencies from encoded string - Oracle (medium)
  • Count closed islands in a grid - Oracle (easy)
  • Implement in-memory data structures and booking API - Oracle (hard)
  • Implement an LRU cache - Oracle (medium)
Oracle logo
Oracle
Jul 26, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
1
0

Given an integer array nums (values may be negative) and an integer T, return the length of the shortest non-empty contiguous subarray whose sum is at least T; return -1 if no such subarray exists. Optimize for n up to 200,000. Explain your approach, prove its correctness, analyze time and space complexity, and implement an O(n) solution.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

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