How do you optimize NumPy code by avoiding hidden copies and using in-place operations and the out= parameter?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Asks how to speed up NumPy code by avoiding hidden copies, using in-place operators and writing results into preallocated arrays with the out= parameter. It tests knowledge of views versus copies, memory layout, dtype casting rules and safe buffer reuse.