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-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
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;
}
}