Binary Palindrome Check

Bit Manipulation Binary Palindrome Coding Problem

Problem: Binary Palindrome Check

Given a non-negative integer, determine if its binary representation (without leading zeros) is a palindrome. A binary palindrome is a binary string that reads the same forwards and backwards.

Example

  • Input: 9

    • Binary representation: "1001"
    • Output: true
  • Input: 10

    • Binary representation: "1010"
    • Output: false

Instructions

  1. Write a function that accepts a non-negative integer.
  2. Convert the integer into its binary representation.
  3. Check if the binary string is a palindrome and return a boolean result.

Hint: You can obtain the binary representation of a number by repeatedly dividing by 2, or by using built-in functions in your language of choice.

Today, on 2025-02-27, consider the symmetry found in nature and history—the same way our planet rotates in a balanced and rhythmic pattern, see if you can find a palindromic balance in bits!