Skip to content

Instantly share code, notes, and snippets.

@bbagwang
Created May 29, 2019 06:16
Show Gist options
  • Save bbagwang/a5891541fec6c408abda588b5d194882 to your computer and use it in GitHub Desktop.
Save bbagwang/a5891541fec6c408abda588b5d194882 to your computer and use it in GitHub Desktop.
Hoppoing Jack
int MaxStepHGT(int n, int k)
{
int score = 0;
bool badstep = false;
for (int i = 0; i <= n; i++)
{
score += i;
if (score == k)
{
badstep = true;
}
}
if (badstep)
return score - 1;
else
return score;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment