Write a function that, given two square matrices *a* and *b*,
computes their sum.

Interface

C++ | typedef vector< vector<int> > Matrix; |

Matrix sum(const Matrix& a, const Matrix& b); | |

Java | public static int[][] sum(int[][] a, int[][] b); |

Python | sum(a, b) # returns list |

sum(a: list, b: list) -> list |

Precondition

*a* and *b* are square matrices n× n with n ≥ 0.

Information

- Author
- Jordi Petit
- Language
- English
- Translator
- Carlos Molina
- Original language
- Catalan
- Other languages
- Catalan
- Official solutions
- C++ Java Python
- User solutions
- C++ Java Python