Declaring DP array
int [ , ] dp = new int [ ( N + 2 ) , ( N + 2 ) ] ; for ( int length = 1 ; length < N + 1 ; length ++ ) { for ( int left = 1 ; left < N - length + 2 ; left ++ ) { int right = left + length - 1 ;