Work in HR or Recruiting?
Palantir Technologies
www.palantir.com Palo Alto, CA 500 to 999 Employees
Work in HR? Complete Your Profile

19 interview experiences Back to all Palantir Technologies Interview Questions & Reviews

Interview Question for Embedded Analyst at Palantir Technologies:
Mar 30, 2012

write a function that finds the remainder between two numbers using only addition, sutraction and multiplication.


Add Tags [?]

See more for this Palantir Technologies Embedded Analyst Interview

Helpful Question?  
Yes | No
Inappropriate?

Answers & Comments (5)

0 of 7 people found this helpful

Apr 17, 2012

by Anonymous:

var x;
var y;
var solution;
var TestSol;
var Remainder;

x * (1/y) = solution;
solution*y = TestSol;
if (TestSol = x)
{
   document.write("Remainder is zero");
}
else
{
x - TestAns = Remainder;
document.write (Remainder);
}
Helpful Answer?  
Yes | No
Inappropriate?

0 of 2 people found this helpful

Apr 17, 2012

by Anonymous:

Oops, forgot to include parseInt()
Helpful Answer?  
Yes | No
Inappropriate?

Jul 2, 2012

by erez:

the first solution is wrong..(1/y) is division dude..

I think the solution is something like this. Suppose x, y are your numbers and you want to find remainder(y/x).

z = x
while z < y
i++
z = x*i
end

remainder = y - (z*(i-1))
Helpful Answer?  
Yes | No
Inappropriate?

6 of 6 people found this helpful

Jul 5, 2012

by Jake S:

This is pretty easy, guys. You don't want to be doing extraneous multiplication because it is veryyyy slowwwww.

X and Y are the numbers to find the remainder of, assume X > Y.

while(x > y) {
x = x - y
}
return x

Example: 10, 4
10 > 4
x = 10 - 4 = 6

6 > 4
x = 6 - 4 = 2

2 < 4
return 2
Helpful Answer?  
Yes | No
Inappropriate?

Oct 9, 2012

by Anonymous:

but if u do a binary search while multiplying then it will be faster then the subtraction method.
Helpful Answer?  
Yes | No
Inappropriate?

To comment on this question, Sign In with Facebook or Sign Up

Palantir Technologies – Why Work for Us?

Palantir Technologies builds software platforms that help human experts perform powerful, collaborative analysis of data at scale. Palantir’s software is deployed at public institutions, private enterprises, and in the… Full Overview

Provided by employer [?]

Tags are like keywords that help categorize interview questions that have something in common.