LeetCode Çözümlerİ – 231. Power of Two [Amazon Mülakat Sorusu]

LeetCode içerisinde bulunan “Power of Two”‘ sorusunun açıklaması ve çözümü. Bu soruda verilen sayının 2’nin pozitif bir tam kuvveti olup olmadığını bulmanız isteniyor. LeetCode’a göre Amazon’da sorulmuş sorulardan biri.

➡️ LeetCode 231. Power of Two: https://leetcode.com/problems/power-of-two/

➡️ Bit Twiddling Hacks: http://graphics.stanford.edu/~seander/bithacks.html

➡️ the bit twiddler: https://bits.stephan-brumme.com/

➡️ The Aggregate Magic Algorithms: http://aggregate.org/MAGIC

➡️ Bit Tricks: https://medium.com/trick-the-interviwer/bit-tricks-577ebb2f1a8b

➡️ Basics of Bit Manipulation: https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/tutorial/

➡️ Problem açıklaması:

Given an integer, write a function to determine if it is a power of two.

Example 1:

Input: 1

Output: true

Explanation: 2^0 = 1

Example 2:

Input: 16

Output: true

Explanation: 2^4 = 16

Example 3:

Input: 218

Output: false

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.