Sap Labs Interview Question for Software Engineer / Developers
- 0of 0 votes
In Mathematics each number has one special number, which it supports, chosen as follows. It counts the number of ones in its own binary representation, and adds this count to itself to obtain the value of the number it supports. That is, if j(m) means the number of ones in the binary representation of m, then m supports m+j(m). For example, the number eight (1000 in binary) supports nine, whereas nine supports eleven.- anonymous June 16, 2014 in India
However, in this way not all the numbers get supported; some are left without support, and we call these numbers bleak. For example since one supports two, two supports three and three supports five, there is no number less than four, which would support four, so four is bleak.
Your task is for a given number recognize if it is bleak or supported by some number.
| Report Duplicate | Flag | PURGE
Sap Labs Software Engineer / Developer Coding
Open Chat in New Window