Katkat

Check diagonal and compute window statistics

MetaMachine Learning Engineer · Technical Screen

Last updated

This question evaluates understanding of array and matrix manipulation, sliding-window and streaming statistics, and appropriate data-structure choices for maintaining aggregates and order-statistics such as moving averages and sliding-window medians.

Question

Given a square matrix, determine whether all elements on its main diagonal are identical.

LeetCode 346. Moving Average from Data Stream – design a class that maintains a sliding window of size k over a data stream and returns the current moving average on each insertion.

LeetCode 480. Sliding Window Median – for an integer array and window size k, output the median of the numbers inside the window as it slides one position at a time.

https://leetcode.com/problems/moving-average-from-data-stream/ https://leetcode.com/problems/sliding-window-median/