Trilogy Interview Question for Software Engineer / Developers






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

use linked list

- Anonymous September 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Let we have two numbers num1 & num2....

num1 is size of m bytes..
num2 is size of n bytes...
dividelist (list *numx, sizeint x, list *numy, sizeint y)
{
list *tempremainder, *tempquotient;

tempquotient = divnum(numx, x-y+1, numy[0]+1 );
limit = divnum(numx, x-y+1 ,numy[0]);
tempquotient = tempquotient+1;

mul1 = multiply (numy, tempquotient));
mul2 = multiply (numy, tempquotient1));

while(tempquotient1 <= limit)
{
if(mul2>numx)
break;

tempquotient =tempquotient1;
tempquotient1++;
mul1 = mul2;
mul2 = multiply (numy, tempquotient1));

}

remainder = subtract(numx , multiply (numy,tempquotient));
quotient = tempquotient;

}
Here ,.. multiply , subtract & increment , can be done simply.. as everybody know.. for two numbers contained in linked lists.. However the complexity would be large enough...

Main Concept : is to divide the first .. m-n+1 segments of first number.. by the first single segment of second number...

so the quotient would be.. between the numbers from ( m-n+1 segments , divided by single first segment of numy) and (m-n+1 segments of numx , divided by single first segement of numy with increment 1)...

My Query is: How this "m-n+1" terms are decided(What is the logic behind choosing this figure) I worket out on this problem....but not able to understand the first "m-n+1" bytes selection logic. Please, give ur suggestion, u can also suggest ur own method as well.

- Shwetank September 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Zwz2zt

- Anonymous May 15, 2022 | Flag Reply


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