Recognizing Patterns and Selecting Algorithms Questions
Ability to recognize problem patterns and know which algorithm/data structure is appropriate. Includes pattern matching like 'this looks like a sliding window problem' or 'this is a backtracking problem'.
MediumTechnical
67 practiced
Implement in Python a function longest_substring_k_distinct(s: str, k: int) -> int that returns the length of the longest substring containing at most k distinct characters. Your solution must be O(n). Show example: s='eceba', k=2 -> 3.
EasyTechnical
70 practiced
Metric selection pattern: when should you prioritize ROC AUC, Precision-Recall AUC, F1, or a task-specific business metric? Provide concrete examples mapping illustration (fraud detection, ad click prediction, medical diagnosis) and explain how class imbalance and cost asymmetry influence choice.
EasyTechnical
75 practiced
Explain the two-sum pattern and when a hashmap approach is preferable to sorting plus two-pointers. In your answer, discuss time and space complexity trade-offs and practical considerations in ML pipelines such as preserving element order, streaming input, and memory constraints.
EasyTechnical
69 practiced
Compare K-fold cross-validation and bootstrap resampling for model evaluation. Explain patterns that make you prefer one over the other in ML experiments, including sample size, variance estimation, bias, computational cost, and applicability to time-series.
MediumTechnical
87 practiced
Implement a Python class SlidingWindowMax that supports push(value: int, timestamp: int) and get_max(current_timestamp: int) returning the maximum value within the window of width W seconds. Design for amortized O(1) push and get_max and assume timestamps are non-decreasing.
Unlock Full Question Bank
Get access to hundreds of Recognizing Patterns and Selecting Algorithms interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.