PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in C programming, API design, low-level data representation for polynomials, and algorithmic competence in performing coefficient convolution while handling edge cases like differing degrees, zero and negative coefficients.

  • medium
  • NVIDIA
  • Coding & Algorithms
  • Software Engineer

Implement polynomial multiplication API in C

Company: NVIDIA

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Problem Implement an API in **C** to multiply two polynomials. A polynomial is represented by its coefficients. You must **define the input and output format** as if you were writing a small library function for other users. Example polynomials: - \(P(x) = x^3 - 2x + 5\) - \(Q(x) = x^2 + 2x + 4\) ## Requirements - Use **C (not C++)**. - Define a clear representation for a polynomial (e.g., array of coefficients where `coeff[i]` is the coefficient of \(x^i\)). - Provide a function (or set of functions) that multiplies two polynomials and returns the result. - Ensure the API handles: - Different degrees for the two inputs - Zero coefficients - Negative coefficients ## Output Return (or fill) a polynomial representing \(R(x) = P(x) \times Q(x)\) using your chosen representation. ## Constraints (you may assume) - Degrees are non-negative integers. - Coefficients fit in 32-bit signed integers (or specify a larger type if you choose). - Time complexity should be better than enumerating all exponent pairs explicitly as strings (i.e., use coefficient convolution).

Quick Answer: This question evaluates proficiency in C programming, API design, low-level data representation for polynomials, and algorithmic competence in performing coefficient convolution while handling edge cases like differing degrees, zero and negative coefficients.

Multiply two polynomials represented as coefficient arrays where coeff[i] is the coefficient of x^i.

Constraints

  • coefficients are integers
  • Trailing zero coefficients are trimmed except for the zero polynomial

Examples

Input: ([5, -2, 0, 1], [4, 2, 1])

Expected Output: [20, 2, 1, 2, 2, 1]

Explanation: Example-style cubic times quadratic.

Input: ([1, 2], [3, 4, 5])

Expected Output: [3, 10, 13, 10]

Explanation: Different degrees.

Input: ([0], [1, 2, 3])

Expected Output: [0]

Explanation: Zero polynomial trims to [0].

Input: ([-1, 1], [-1, 1])

Expected Output: [1, -2, 1]

Explanation: Negative coefficients.

Hints

  1. Use coefficient convolution: result[i+j] += p[i] * q[j].
Last updated: Jun 27, 2026

Loading coding console...

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.

Related Coding Questions

  • Compute the Final Robot Score - NVIDIA (easy)
  • Return all file paths via DFS - NVIDIA (easy)
  • Implement a disk space manager with eviction - NVIDIA (medium)
  • Implement short algorithms on logs, grids, and strings - NVIDIA (hard)
  • Implement encode/decode for list of strings - NVIDIA (easy)