Created
September 17, 2020 07:20
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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