Skip to content

Instantly share code, notes, and snippets.

@shubham1710
Created January 9, 2020 12:42
Show Gist options
  • Select an option

  • Save shubham1710/5afd8f73718382a188a765d84130989d to your computer and use it in GitHub Desktop.

Select an option

Save shubham1710/5afd8f73718382a188a765d84130989d to your computer and use it in GitHub Desktop.
ll ans = INF;
for(int color = 1; color < N-1; color++){
for(int ind = 0; ind < dogs[color].size(); ind++){
if(ind+1 > k)
break;
for(int taken = 0; taken <= k - ind - 1; taken++)
ans = min(ans, dogs[color][ind] + pre[color-1][taken] + suf[color+1][k - taken - ind - 1]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment