Skip to content

Instantly share code, notes, and snippets.

@hassan-maavan
Created September 17, 2020 07:20
Show Gist options
  • Save hassan-maavan/d79cb573c3ad32f8f1384e31bd246db3 to your computer and use it in GitHub Desktop.
Save hassan-maavan/d79cb573c3ad32f8f1384e31bd246db3 to your computer and use it in GitHub Desktop.
Given a number k, find the smallest integer n such that if any k elements are removed from the set {1, 2, ..., n}, one can still find k distinct numbers among the remaining elements with sum of n.
function removeK(k){
return k * (3*k + 1) / 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment