3ms accepted with the help of bitset and reverse


  • 0
    P
           	string s =std::bitset< 32 >( n ).to_string(); 
           	reverse(s.begin(),s.end());
           	std::bitset<32> after(s);
           	uint32_t res =after.to_ulong();
           	return res;
       }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.