PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/OpenAI

Implement vectorized NumPy ops and explain broadcasting

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in vectorized numerical computing with NumPy, understanding of broadcasting semantics, and awareness of numerical stability and algorithmic time/space complexity when manipulating high-dimensional arrays.

  • Medium
  • OpenAI
  • Data Manipulation (SQL/Python)
  • Machine Learning Engineer

Implement vectorized NumPy ops and explain broadcasting

Company: OpenAI

Role: Machine Learning Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

Implement vectorized NumPy code for: (a) computing pairwise cosine similarity between two real-valued matrices X (shape n×d) and Y (shape m×d) without explicit Python loops; (b) computing a numerically stable softmax for a 2D array along the last axis; (c) explaining how broadcasting works if X has shape (n, 1, d) and Y has shape (1, m, d). Analyze time and space complexity, and discuss pitfalls such as unintended broadcasting, dtype issues, and memory usage.

Quick Answer: This question evaluates proficiency in vectorized numerical computing with NumPy, understanding of broadcasting semantics, and awareness of numerical stability and algorithmic time/space complexity when manipulating high-dimensional arrays.

Related Interview Questions

  • Write SQL for repeat churn - OpenAI (hard)
  • Handle repeated churn in SQL - OpenAI (hard)
  • Compute churn with re-subscriptions - OpenAI (hard)
  • Debug and harden trial-assignment Python code - OpenAI (Medium)
  • Write SQL for post-trial conversion cohorts - OpenAI (Medium)
OpenAI logo
OpenAI
Aug 11, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Data Manipulation (SQL/Python)
15
0

Implement vectorized NumPy code for: (a) computing pairwise cosine similarity between two real-valued matrices X (shape n×d) and Y (shape m×d) without explicit Python loops; (b) computing a numerically stable softmax for a 2D array along the last axis; (c) explaining how broadcasting works if X has shape (n, 1, d) and Y has shape (1, m, d). Analyze time and space complexity, and discuss pitfalls such as unintended broadcasting, dtype issues, and memory usage.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More OpenAI•More Machine Learning Engineer•OpenAI Machine Learning Engineer•OpenAI Data Manipulation (SQL/Python)•Machine Learning Engineer Data Manipulation (SQL/Python)
PracHub

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

Product

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