com_github_leetcode.BinaryMatrixImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java17 Show documentation
Show all versions of leetcode-in-java17 Show documentation
Java Solution for LeetCode algorithm problems, continually updating
package com_github_leetcode;
import java.util.ArrayList;
import java.util.List;
public class BinaryMatrixImpl implements BinaryMatrix {
private final int[][] matrix;
public BinaryMatrixImpl(int[][] matrix) {
this.matrix = matrix;
}
@Override
public int get(int x, int y) {
return matrix[x][y];
}
@Override
public List dimensions() {
List dimensions = new ArrayList<>();
dimensions.add(matrix.length);
dimensions.add(matrix[0].length);
return dimensions;
}
}