Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions 08_recursion_and_dynamic_programming/02_robotGrid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Imagine a robot sitting on the upper left corner of grid with r rows and c columns
The robot can only move in two directions, right and down, but certain cells are
'off limits' such that the robot cannot step on them. Design an algorithm to find
a path for the robot from the top left to the bottom right.
*/

function robotGrid(grid) {
// Your code here
}

module.exports = robotGrid;
16 changes: 16 additions & 0 deletions 08_recursion_and_dynamic_programming/02_robotGrid.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const assert = require('chai').assert;
const robotGrid = require('./02_robotGrid');

describe('recursion and dynamic programming', function() {
describe('robot grid', function() {
it('should return a valid path', function() {
const matrix = [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]

assert.equal(robotGrid(matrix).length, 4);
})
})
})