Javascript

const reverseBits = function(n) {
    let result = 0;
    
    for (let i = 0; i < 32; i++) {
        // Shift the result to the left and add the rightmost bit of n
        result = (result << 1) | (n & 1);
        // Shift n to the right to get the next rightmost bit
        n = n >> 1;
    }
    
    return result >>> 0; // Ensure the result is treated as an unsigned integer
};
 
// Example usage:
const n = 43261596;
console.log(reverseBits(n)); // Output: 964176192