PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Pinterest

Generate all hyperparameter combinations

Last updated: Mar 29, 2026

Quick Overview

This question evaluates competence in combinatorial enumeration and manipulation of data structures for generating hyperparameter configurations, testing understanding of Cartesian products and correctness of produced configuration sets.

  • medium
  • Pinterest
  • Coding & Algorithms
  • Machine Learning Engineer

Generate all hyperparameter combinations

Company: Pinterest

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given several *groups* of hyperparameter choices for an ML experiment. Each group contains one hyperparameter name and a list of candidate values. Return **all possible configurations** (the Cartesian product across groups), where each configuration assigns **exactly one value** to each hyperparameter. ### Input - A list of `k` hyperparameter groups, e.g. - `[("lr", [0.1, 0.01]), ("batch", [16, 32, 64]), ("optimizer", ["sgd", "adam"])]` ### Output - A list of configurations, each configuration represented as a map/dictionary from name → chosen value. ### Constraints / expectations - If any group has an empty value list, the result should be empty. - Order does not matter, but the output should not contain duplicates. - Discuss a few test cases (including edge cases) you would use to validate the implementation.

Quick Answer: This question evaluates competence in combinatorial enumeration and manipulation of data structures for generating hyperparameter configurations, testing understanding of Cartesian products and correctness of produced configuration sets.

Related Interview Questions

  • Design Hierarchical Permission Checks - Pinterest (medium)
  • Implement weighted random choice - Pinterest (medium)
  • Solve five hard algorithm problems - Pinterest
  • Sample a string by real-valued scores - Pinterest (hard)
  • Find First Prefix-Matching Word - Pinterest (medium)
Pinterest logo
Pinterest
Jan 22, 2026, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
8
0
Loading...

You are given several groups of hyperparameter choices for an ML experiment. Each group contains one hyperparameter name and a list of candidate values.

Return all possible configurations (the Cartesian product across groups), where each configuration assigns exactly one value to each hyperparameter.

Input

  • A list of k hyperparameter groups, e.g.
    • [("lr", [0.1, 0.01]), ("batch", [16, 32, 64]), ("optimizer", ["sgd", "adam"])]

Output

  • A list of configurations, each configuration represented as a map/dictionary from name → chosen value.

Constraints / expectations

  • If any group has an empty value list, the result should be empty.
  • Order does not matter, but the output should not contain duplicates.
  • Discuss a few test cases (including edge cases) you would use to validate the implementation.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Pinterest•More Machine Learning Engineer•Pinterest Machine Learning Engineer•Pinterest Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • 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.