Topic — Add New » Posts Last Poster Freshness
Amazon Interview Question for Software Engineer/Developer (0 - 2 Years) about Algorithms 14 PsychoCoder 18 hours

write an algorithm finding the no.of one bits from 1 to n,for given any n value.
complexity should be good
example:
1=1
2=10
3=11
4=100
5=101
6=110
.
.
if n=3 then ur answer is 4
if n=6 then ur answer is 9

Interviewer is looking for an algo in O(log n)time complexity

Amazon
Amazon Interview Question for Software Engineer/Developer about Algorithms, Bit Magic 13 atul007 6 days

An array A[1...n] contains all the integers from 0 to n except for one number which is missing. In this problem, we cannot access an entire integer in A with a single operation. The elements of A are represented in binary, and the only operation we can use to access them is “fetch the jth bit of A[i]”, which takes constant time. Write code to find the missing integer. Can you do it in O(n) time?

Amazon
even or odd 2 kartik 2 weeks

how can we find wather given number is even or odd without using module operator

Qualcomm Interview Question for Software Engineer/Developer (Fresher) about Bit Magic 5 aaa 3 weeks

How to find whether a machine is 32bit or 64 bit? Write code for this

Qualcomm
Interview Question for Software Engineer/Developer about Bit Magic 1 joseph 4 weeks

First some definitions for this problem: a) An ASCII character is one byte long and the most significant bit in the byte is always '0'. b) A Kanji character is two bytes long. The only characteristic of a Kanji character is that in its first byte the most significant bit is '1'.
Now you are given an array of a characters (both ASCII and Kanji) and, an index into the array. The index points to the start of some character. Now you need to write a function to do a backspace (i.e. delete th...

Qualcomm Interview Question for Software Engineer/Developer (Fresher) about Bit Magic 3 jitendra 1 month

Bit palindrome:
Write a function to check if the bit-wise representation of an integer is a palindrome.

eg. 5, 9, etc. are palindromes.

Qualcomm
Adobe Interview Question for Software Engineer/Developer (Fresher) about Bit Magic 7 Venkatesh 1 month

You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j).
EXAMPLE:
Input: N = 10000000000, M = 10101, i = 2, j = 6
Output: N = 10001010100
_
________________________________________________________________

Adobe
Qualcomm Interview Question for Software Engineer/Developer (Fresher) about Bit Magic 2 gaurav 1 month

Given a byte, write a code to swap every two bits. [Using bit operators] Eg: Input: 10 01 11 01 Output: 01 10 11 10

Qualcomm
Swapping two nos without arithmetic and logical operators 4 ayyappa 1 month

Tis was asked for my frend in thought works interview..... How to swap two numbers without using a temporary variable, logical and arithmetic operators?

Adobe Interview Question for Software Engineer/Developer (0 - 2 Years) about Bit Magic 3 Shubhra 1 month

You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j).
EXAMPLE:
Input: N = 10000000000, M = 10101, i = 2, j = 6
Output: N = 10001010100

Adobe
Microsoft Interview Question for Software Engineer/Developer (Fresher) about Bit Magic 7 Shantanu 1 month

given a 32-bit integer x. find the smallest integer x0 > x with the same number of ones in binary representation

Example:
x = 76
x0 = 81

Microsoft
Microsoft Interview Question for Software Engineer/Developer about Bit Magic 2 Abhimanyu Vohra 1 month

two 32bit integers m,n are given.replace all the bits in m from i to j locations with all the bits in n from k to l locations....
eg. m = 110000000000 n = 10101010 i=3 j=5 k=5 l=7
o/p:110000101000

Microsoft
Microsoft Interview Question about Algorithms, Bit Magic 5 surya 2 months

What are the different ways to say, the value of x can be either a 0 or a 1. Apparently the if then else solution has a jump when written out in assembly.

        if (x == 0)
                y = a
        else
                y = b

There is a logical, arithmetic and a datastructure soln to the above problem.

Microsoft
sort an array of 1,0 in log(n) time 4 angel_eyez 3 months

sort an array of 1,0 in log n time

Divisible by 3. If yes find the quotient 6 mystry 3 months

You are given with Binary Representation of a Number.
Using only BitWise operation (No *, / , %) Find if the Number is divisible by 3.
If yes, then return the quotient. else return -1.

DE Shaw Interview Question for Software Engineer/Developer (Fresher) about Bit Magic 1 3 months

how can we reverse a number using bitwise operators?

DE Shaw
In any given number, how to swap two consequtive bits 3 gaurav 3 months

Consider a number whose binary representation is : 10110010.
To represent it more clearly if represented as pairs of two bits the number would be : 10-11-00-10
After Swappiing the result should be : 01-11-00-01.

Please provide a generic solution which could be valid for a number of any size(1 byte, 2byte, 4 byte)