FastPrepClassify Heap Addresses from a Memory Snapshot
Problems/Classify Heap Addresses from a Memory Snapshot

Classify Heap Addresses from a Memory Snapshot

Squarepoint Capital logoSquarepoint Capital● MediumNEW GRADPHONE SCREEN

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for a C++ heap-versus-stack address predicate but gives no runtime inspection method. This version supplies a disjoint memory-region snapshot and tests membership, so it does not claim portable classification of arbitrary raw pointers. The bounded classification capability matches the source at about 55%.

For this exercise, assume a process supplies an authoritative memory snapshot. Each row in regions is [start, end, kind] and covers integer addresses in the half-open interval [start, end). A kind of 1 marks heap memory; a kind of 0 marks stack memory.

For every value in addresses, return true exactly when it lies in a region marked as heap. Return false for stack addresses and for addresses absent from the snapshot. Address 0 represents null and is never included in a region.

The regions may arrive in any order. They do not overlap. Return the decisions in the same order as the queries.

Function

classifyHeapAddresses(regions: int[][], addresses: int[]) → boolean[]

Examples

Example 1

regions = [[100,200,1],[300,400,0]]addresses = [100,199,200,350,0]return = [true,true,false,false,false]

100 and 199 are inside the heap interval. Its end 200 is excluded. Address 350 is stack memory, and 0 is null.

Example 2

regions = [[50,60,0],[10,20,1]]addresses = [15,55,80]return = [true,false,false]

The region order does not matter. Address 15 is heap, 55 is stack, and 80 is not listed.

Example 3

regions = []addresses = [0,5]return = [false,false]

An empty snapshot contains no known heap interval, so both queries return false.

Constraints

  • 0 <= regions.length <= 1000.
  • Every region has exactly 3 fields.
  • 0 <= regions[i][j] <= 1000000000.
  • For each region, 1 <= start < end, and kind is 0 or 1. Regions are pairwise disjoint; touching endpoints are allowed.
  • 0 <= addresses.length <= 1000.
  • 0 <= addresses[i] <= 1000000000.

More Squarepoint Capital Phone Screen questions

  • Newton Square Root to a Guaranteed TolerancePHONE SCREEN · Seen Nov 2026
  • Probability of Consecutive HeadsPHONE SCREEN · Seen Nov 2026
  • Three Points in a Semicircle: Monte Carlo EstimatePHONE SCREEN · Seen Nov 2026
  • Combine Two Index SequencesPHONE SCREEN · Seen Aug 2026
  • Parse, Normalize, and Combine PolynomialsPHONE SCREEN · Seen Aug 2026
  • Sorted Insertion SnapshotsPHONE SCREEN · Seen Aug 2026
  • Strong and Weak Reference LifecyclePHONE SCREEN · Seen Aug 2026
  • Target Sum Across Two Sorted ArraysPHONE SCREEN · Seen Aug 2026
  • Fixed Worker Pool with a Shared QueuePHONE SCREEN · Seen Nov 2025
  • String Copy and Move LifecyclePHONE SCREEN · Seen Nov 2025

Similar questions at other companies

  • Batch Point-in-Range QueriesGoogle · PHONE SCREENGoogle interview questions
  • Maximum Profit in Job SchedulingAmazon · PHONE SCREEN
  • Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
  • Maximum Team SizeExpedia · OAExpedia interview questions
  • Merge Overlapping IntervalsAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions
  • Majority Labels over Audio IntervalsNooks · PHONE SCREEN
  • Meeting Rooms IIUber · PHONE SCREENUber interview questions

Interview reports that mention this question

  • Squarepoint Capital C++ and Python SWE Interviews: 7 Experiences

Squarepoint Capital interview experiences

  • Squarepoint Campus SDE Interviews: 7 Experiences (Part 2 of 2)
  • Squarepoint Capital New Grad SDE OA: 5 Experiences (Part 1 of 2)
All Squarepoint Capital interview questionsSee Squarepoint Capital hiring insights
Saved
class Solution {
    public boolean[] classifyHeapAddresses(int[][] regions, int[] addresses) {
        // write your code here
    }
}
Checking account…