There was an error while loading. Please reload this page.
Let's A be a matrix
A = [ 2 3 2 1 ] [ 5 2 3 1 ] [ 1 2 2 1 ] width = 4 heigh = 3
You can move RIGTH or DOWN. You cannot move UP or LEFT.
Write a webservice that calculate the highest path sum in a matrix following this rule (move only RIGTH or DOWN)
In this exemple, the highest path is :
[*2 3 2 1 ] [*5 *2 *3 1 ] [ 1 2 *2 *1 ] => 2 + 5 + 2 + 3 + 2 + 1 = 15
//src/AppBundle/Controller/Test3Controller public function test3Action(Request $request) { $matrix = $request->request->get('matrix'); $height = $request->request->get('height'); $width = $request->request->get('width'); $result = -1; return new Response($result, Response::HTTP_OK); }
$ curl -H "Content-Type: application/json" -X POST -d '{"matrix":[[2,3,2,1],[5,2,3,1],[1,2,2,1]],"width":4,"height":4}' test.local/test3 15