Skip to content
Vincent Oliveira edited this page Sep 6, 2016 · 4 revisions

Tiller Test Dev Backend - Test 3

What should I do ?

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)

Where should I write my code ?

    //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);
    }

How can I test my code ?

$ 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

Clone this wiki locally