Adobe Interview Question for Developer Program Engineers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
3
of 3 vote

remainder=0
remainder=(remainder*2+incoming_bit)%3

- Shobhit July 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I side with this solution. Why does everyone always want to use state machines for these sorts of problems? I mean, what if your requirements change and you need to do it mod 77 now? Better to write general code if you can.

- eugene.yarovoi July 07, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

S = (S << 1 + I) % 3

- Chahal.ac July 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

if(!s) return true; else return false;

- Chahal.ac July 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry i cant get this one correct me if i am wrong :-

remainder=0
remainder=(remainder*2+incoming_bit)%3
second statement will evaluate to => remainder = (0*2+incoming_bit)%3
=> remainder = (0 + incoming_bit)%3

where is the use remainder in RHS ?

- Read Fox August 28, 2012 | Flag
Comment hidden because of low score. Click to expand.
2
of 4 vote

try to use DFA that will accept modulo 0 state of DFA...If at the point of checking the sate is modulo 0 then yes else no....

- L.Ppt July 03, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

remainder=(remainder*2+incoming_bit)%3 is not givin right ans..for input 39

- Anonymous July 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

It is giving right ans . Check it again . 39=(starting_bit)100111(end_bit)
1 == rem=1
10 == rem=2
100 == rem=1
1001 == rem=0
10011 == rem=1
100111 == rem=0
Hence , proved

- Shobhit July 06, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

nicely explained !!

- Sankarshan September 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

here remainder we wil initiate with 1 or 0 ??

- karthi July 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

remainder=0

- Shobhit July 06, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

with every new bit, the current number becomes -
c = 2*c + newbit;
for the above to be divisible by 3,
2c mod 3 == 0 and newbit mod 3 == 0
if c is divisible by 3, newbit has to be 0
if c is 2 mod 3, newbit has to be 1
if c is 1 mod 3, the next number will never be divisible by 3.

- Anonymous July 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Barney.. yes u r rite :)

- Anonymous July 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

we simply need to maintain a running sum s which can take only three values and when evry bit comes we have to perform the opperation
initialise s=0;
s= (s+curr_bit)%3
when the stream stops check:
if(!s) return true;
return false;

- sandeep July 06, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

to all those who are counting number of 1's : check it for 101 or 10101

- BABA July 07, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Result = ((Number<<1) | Incomin_Bit) ^ 3

if( result == 0)
return True;
else
false;

- Himanshu chauhan August 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

If the difference of number of 1's in even and odd positions is 0, then the number will be divisible by 3.

- Srishti September 01, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

count the no. of one's at even position and count the no. of one's at odd position.
If both the counts are equal then number is divisible by 3.

At any instance xor even count and odd count.
if evencount xor oddcount = 0 then divisible.
else not.

- varun July 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

at any instance count the no of 1s .if the count is 2,the number is divisible by 3 otherwise not.

- zzz July 03, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

At any instance instead, Count the number of one's, if its even, the number is divisible by 3.

- Sulabh July 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

So dude do you think 101 is divisible by 3?

- Chiku August 03, 2012 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More