text: Variable visited is used to keep track of all the visited positions Variable dp is used to store maximum sum till current position
code: vector < vector < int > > dp ( N , vector < int > ( N ) ) , visited ( N , vector < int > ( N ) ) ;