What is broadcasting in a NumPy array and what is it used for?
Asked in the 1st Round Technical Interview stage. Demonstrate the concept by implementing broadcasting for element-wise addition without importing NumPy.
Implement broadcast_add(a, b), where each input is a scalar or a rectangular nested Python list of numbers. Align dimensions from the right. Two dimensions are compatible when they are equal or one is 1. Return a new nested list with the broadcasted shape containing element-wise sums.
def broadcast_add(a, b):