2
def maxSizeSlices(self, slices: List[int]) -> int:3
** #This solve function mainly on work on the idea of A Previous dp problem House Robber II 4
#If we take the first slice then we cant take the second slice and vice versa**5
def solve(slices,start,end,n,dp):10
include = slices[start] + solve(slices,start+2,end,n-1,dp)12
exclude = 0 + solve(slices,start+1,end,n,dp)14
dp[start][n]= max(include,exclude)16
dp1=[[-1 for i in range(k+1)]for _ in range(k+1)]17
dp2=[[-1 for i in range(k+1)]for _ in range(k+1)]19
option1=solve(slices,0,k-2,k//3,dp1)#Taking the the first slice , now we cant take the last slice and next slice20
option2=solve(slices,1,k-1,k//3,dp2)#Taking the the second slice , now we cant take the second last slice and next slice22
return max(option1,option2)