InterviewDB Question

Longest Stable Transaction Period - Coding Interview

Question Details

Problem Given a list of transaction amounts in chronological order, find the longest contiguous subarray where the standard deviation of amounts is at most sigma_max. This represents the longest "stable" trading period. Example: Note: Use population standard deviation (divide by n, not n-1). Approach Brute force O(n^2): for each subarray recompute mean and std. Maintain running sum and sum of squares for O(1) incremental updates: std = sqrt(sum_sq/n - (sum/n)^2). Follow-ups Is a two-pointer / sl…

Full Details

🔒

Unlock all Codesignal questions

Full insider details, leaked discussions, and candidate experiences.

or every company, $100/year →

About This Question

This is a reported interview question from a codesignal interview.

It covers the following topics: Q4, Two Pointers, Sliding Window, General Coding Assessment, Coding, Arrays .