Click here to download the IntelliJ project for this exercise. Alternatively, you can find all the exercices on this git repository
This exercise is already available in your IntelliJ as a project.
What you need to do is described in the comments at the top of the file in src/main/java/
.
package basics; public class Matrix { /** * Create a matrix from a String. * * The string if formatted as follow: * - Each row of the matrix is separated by a newline * character \n * - Each element of the rows are separated by a space * * @param s The input String * @return The matrix represented by the String */ public static int[][] buildFrom(String s) { return null; } /** * Compute the sum of the element in a matrix * * @param matrix The input matrix * @return The sum of the element in matrix */ public static int sum(int[][] matrix) { return 0; } /** * Compute the transpose of a matrix * * @param matrix The input matrix * @return A new matrix that is the transpose of matrix */ public static int[][] transpose(int[][] matrix) { return null; } /** * Compute the product of two matrix * * @param matrix1 A n x m matrix * @param matrix2 A m x k matrix * @return The n x k matrix product of matrix1 and matrix2 */ public static int[][] product(int[][] matrix1, int[][] matrix2) { return null; } }
- Instruction provided at the top of the source file on IntelliJ.
- Debug using small and easy unit tests provided in junit tests, it can also help to clarify the instructions.