PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/OpenAI

Implement vectorized NumPy ops and explain broadcasting

Last updated: May 27, 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)
|Home/Data Manipulation (SQL/Python)/OpenAI

Implement vectorized NumPy ops and explain broadcasting

OpenAI logo
OpenAI
Aug 11, 2025, 12:00 AM
MediumMachine Learning EngineerOnsiteData Manipulation (SQL/Python)
19
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.

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)

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,000+ 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
  • AI Coding 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.