{"push_id":3170319828,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"962eb432596165b294946fb684a165a54694f66b","before":"3c160ccbbc8c6575f22f9d014cd4ea11166f83c3","commits":[{"sha":"962eb432596165b294946fb684a165a54694f66b","author":{"name":"Jatish Khanna","email":"309aff6fc476da51c5cbf1db2bd6cd9decadb8d6@gmail.com"},"message":"Check if a given number is sparse or not\n\nA number is said to be a sparse number if in binary representation of the number no two or more consecutive bits are set. Write a function to check if a given number is Sparse or not.\r\nExample :\r\n\r\nInput:  x  = 72\r\nOutput: true\r\nExplanation:  Binary representation of 72 is 01001000. \r\nThere are no two consecutive 1's in binary representation\r\n\r\nInput:  x  = 12\r\nOutput: false\r\nExplanation:  Binary representation of 12 is 1100. \r\nThird and fourth bits (from end) are set.\r\n\r\n\r\n\r\n \r\n\r\nWe strongly recommend that you click here and practice it, before moving on to the solution.\r\n\r\nIf we observer carefully, then we can notice that if we can use bitwise AND of binary representation of the “given number its “right shifted number”(i.e., half the given number) to figure out whether the number is sparse or not. Result of AND operator would be 0 if number is sparse and non-zero if not sparse.\r\n\r\nPhoto5354-1\r\n\r\nBelow is the implementation of above idea.","distinct":true,"url":"https://api.github.com/repos/Jatish-Khanna/ToDo/commits/962eb432596165b294946fb684a165a54694f66b"}]}
{"actor":{"display_login":"Jatish-Khanna"}}