Skip to content

Instantly share code, notes, and snippets.

@clarkdo
Created January 30, 2018 10:05
Show Gist options
  • Save clarkdo/3a39e485ddc82f6cda578854bdd73891 to your computer and use it in GitHub Desktop.
Save clarkdo/3a39e485ddc82f6cda578854bdd73891 to your computer and use it in GitHub Desktop.
class Solution {
public int solution(int N) {
int A = (int)Math.round(Math.sqrt(N));
while (N % A != 0) A--;
return 2*(A + N/A);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment