If asked in a technical interview, could you write a function to determine if an integer is a power of two? For example:
Input: 1 Output: true Explanation: 20 = 1 Input: 16 Output: true Explanation: 24 = 16 Input: 218 Output: false
Hints
Even though the Swift SDK has built in functionality to accomplish this task, how would you write this algorithm from scratch? Could the input values be interpreted in a different way to achieve our objective?