3 line code in c++


int Solution::power(string B) {
long double A=stold(B);
if(A==0|| A==1) return 0;
return floor(log2(A))==ceil(log2(A))?1:0;


Can u plz explain this ?
I mean how does this work bcoz stol is giving out of bounds!!!


use this to avoid that;
int i;
to convert string to integer


long double has a max of 16 bits but surpringly this soln works. This should be giving an out of range exception for stold!!! HOW??


if you wanted to be get rejected in your interview then use it.it helps to reject you in first round.