PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/OpenAI

Analyze matrix multiplication complexity

Last updated: Apr 13, 2026

Quick Overview

This question evaluates understanding of time and space complexity for matrix multiplication and memory accounting in ML workloads, testing competency in asymptotic analysis, linear algebra operations, and resource estimation.

  • hard
  • OpenAI
  • Software Engineering Fundamentals
  • Machine Learning Engineer

Analyze matrix multiplication complexity

Company: OpenAI

Role: Machine Learning Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Technical Screen

You are asked in an ML coding interview: Given two dense matrices A and B, where A has shape (m, n) and B has shape (n, p), you compute C = A @ B (standard matrix multiplication, as in NumPy/PyTorch). 1) What is the time complexity of this operation in Big-O notation (in terms of m, n, p)? 2) What is the space complexity (extra memory usage) of this operation? Clearly state whether you count the output matrix C as part of the space. Optional follow-up: How does your answer change (if at all) if A and B are batched, e.g., A is (b, m, n) and B is (b, n, p) and you compute a batched matmul?

Quick Answer: This question evaluates understanding of time and space complexity for matrix multiplication and memory accounting in ML workloads, testing competency in asymptotic analysis, linear algebra operations, and resource estimation.

Related Interview Questions

  • Implement a Simple Memory Allocator - OpenAI (medium)
  • Implement an Extensible Chatbot App - OpenAI (medium)
  • Build a Reliable Streaming Chat UI - OpenAI (hard)
  • Design an Extensible Simulation Engine - OpenAI (hard)
  • Debug a Concurrent Job Scheduler - OpenAI (medium)
OpenAI logo
OpenAI
Feb 11, 2026, 12:00 AM
Machine Learning Engineer
Technical Screen
Software Engineering Fundamentals
57
0

You are asked in an ML coding interview:

Given two dense matrices A and B, where A has shape (m, n) and B has shape (n, p), you compute C = A @ B (standard matrix multiplication, as in NumPy/PyTorch).

  1. What is the time complexity of this operation in Big-O notation (in terms of m, n, p)?
  2. What is the space complexity (extra memory usage) of this operation? Clearly state whether you count the output matrix C as part of the space.

Optional follow-up: How does your answer change (if at all) if A and B are batched, e.g., A is (b, m, n) and B is (b, n, p) and you compute a batched matmul?

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More OpenAI•More Machine Learning Engineer•OpenAI Machine Learning Engineer•OpenAI Software Engineering Fundamentals•Machine Learning Engineer Software Engineering Fundamentals
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
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.