We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I solved this using reflection, as that was in the import statements, so I assumed that was what was being tested. Otherwise, it can be done in one line in Java, passes all tests (and admittedly it's much the same as SeanRMunoz's solution):
System.out.println(String.format("%d is %s",num,newInner().newPrivate().powerof2(num)));
That seems too easy for a medium challenge though.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Can You Access?
You are viewing a single comment's thread. Return to all comments →
I solved this using reflection, as that was in the import statements, so I assumed that was what was being tested. Otherwise, it can be done in one line in Java, passes all tests (and admittedly it's much the same as SeanRMunoz's solution):
That seems too easy for a medium challenge though.