Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx
69
var assert = require('assert');
function smallestDist(matrix, A, B) {
// Fill in
}
try {
let matrix = [
['x', 'x', 'A', 'x', 'B'],
['x', 'A', 'x', 'x', 'x'],
['x', 'x', 'x', 'B', 'x'],
['A', 'x', 'x', 'x', 'x'],
['x', 'A', 'x', 'A', 'A'],
];
let result = smallestDist(matrix, 'A', 'B');
assert.equal(2, result, 'Wrong Answer');
console.log(
'PASSED: ' +
"The below matrix with A='A' and B='B' should return 2.let matrix = [ ['x', 'x', 'A', 'x', 'B'], ['x', 'A', 'x', 'x', 'x'], ['x', 'x', 'x', 'B', 'x'], ['A', 'x', 'x', 'x', 'x'], ['x', 'A', 'x', 'A', 'A'],]"
);
} catch (err) {
console.log(err);
}
try {
let matrix = [
OUTPUT
Results will appear here.