Vancouver, BC interview questions | Glassdoor.ca

# Interview questions in Vancouver, BC

SAP Interviews in Vancouver

www.sap.com /  HQ: Walldorf, GM

133 Interviews in Vancouver (of 2,008)

2.8 Average

University of British Columbia Interviews in Vancouver

www.ubc.ca /  HQ: Vancouver, CA

106 Interviews in Vancouver (of 156)

2.7 Average

Starbucks Interviews in Vancouver

www.starbucks.com /  HQ: Seattle, WA

104 Interviews in Vancouver (of 4,890)

2.2 Easy

## Interview Questions in Vancouver

Sort: RelevancePopular Date

3 Nov, 2012
 implement sqrt without using math libray9 Answerse^((ln(x))/2)I think exp and ln still require a Math library. How about using Newton's method to find the root of f(x) = x^2 - a, where x is the solution (the sought square root) and where a is the number for which you want to find the square root?I would have implemented either Taylor or MacLaurin series, centered at an integer number that is closest to the number that you want to find the square root for, such that the square root of this integer is clean. So if you wanted to find the square root of 8.5, I would centre the series at 9 (sqrt(9) = 3), then compute the series at that point. I'd probably choose between 8 and 10 terms, as that is what is used in any scientific calculator.Show more responsesActually, to add to that, I wouldn't be able to include 8 - 10 terms, as that would rely on the square root operation itself.... so I'd have to rely on a linear approximation.This is the way to go. Fast inverse square root as used in Quake III. float Q_rsqrt( float number ) { long i; float x2, y; const float threehalfs = 1.5F; x2 = number * 0.5F; y = number; i = * ( long * ) &y; // evil floating point bit level hacking i = 0x5f3759df - ( i >> 1 ); // what the fuck? y = * ( float * ) &i; y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed return y; }For detailed explanation of the algorithm, see http://en.wikipedia.org/wiki/Fast_inverse_square_rootI wouldn't know about this algorithm, but I can think of a (definitely slower than this one) bisection algorithm to find the root of x^2 = number.Often what they are looking for is a programming data structures oriented solution. Such as using binary search to find sq root etc.poop

19 Apr, 2012
 A man is rowing a boat to travel up the river. each day he travels 5 miles upstream but at night when he resting he travels 4 miles downstream. How many days does he take to travel 20 miles?5 AnswersThe correct answer is probably not the one you come up with first. Requires you to have a good grasp of the scenario and some lateral thinking.4 days they didn't ask abt nights16 daysShow more responsesHe travels 9 miles a day, so just over 2.Interesting. I too think its 16. travels net 1 a day, after 15 days he's 15 miles. On the 16th day he'll row miles 15 to 20 and obviously stop so he's not gonna drift back down. In fairness I think Hell's answer would get some points for thinking outside the box!!

### Software Engineer at McKesson was asked...

6 Jun, 2011
 Given an array of 1001 elements, consists all numbers from 1-1000. Only one number is repeated. Write a function that returns the repeated number.4 AnswersHonestly, there's two possible answers you could give, depending on whether you want space efficiency or time efficiency (assuming that the array is *not* sorted). For time efficiency, ironically, the brute-force method is fastest. You make a counter array of size 1000, all indices initialized to 0, which takes O(n) time. Then, you run the following: for (int i = 0; i 1) // pre-increment the counter, then check if we've counted 2. return array[i]; } Overall, the time-efficient algorithm takes O(2n) = O(n) time, but takes O(n) additional space. The space-efficient algorithm just quick- or heap-sorts the array in place, then runs a binary search, comparing the value to the index. If the value == array[mid], search higher; otherwise search lower. Leave the loop once (high - low == 1), and then return that value. This will take O(n log n) time due to the sorting process, but only take up O(1) extra space. Of course, if the array comes pre-sorted, you would trivially just run binary search as described above.hey, i have one quick solution, create a function that will take up an initial value and end value, that will add up all numbers between them. create another function to add all elements in the array. call the first function, with value (1, 1000) and call the second function. compare the value. whatever the difference is, that is the repeated number.I think Lucas has the right idea with his counter but there's one flaw to his posted solution. His check should be (if ++counter[array[i]-1] > 1). If you do indeed declare the count tracker as int counter[1000] (which is the values counter[0] to counter[999]), doing counter[array[i]] would cause an out of bounds problem for array[i] = 1000. A third alternative, along the lines of dsutandi's idea, is to recognize (if you took a number series class) that the sum of 1 to n = n *(n+1) / 2. So you can loop through the incoming array, sum up all the values, then subtract that sum against the afforementioned value (inserting 1000 for n) and that would be your duplicate. For example: int sum = 0; for (int i = 0; i < 1001; i++){ sum += array[i]; } return sum - (1000*1001)/2;Show more responseshere is my take : use following formula to get ideal sum : ideal_sum= n*(n+1)/2 real_sum=summation_of_all numbers in array repeated number = abs(real_sum-ideal_sum)

### Senior Software Engineer at Amazon was asked...

16 Aug, 2012
 Write a function that divides one number by another, without using the division operator, and make it better than O(n).7 AnswersThis can be done in a recursive function, the following code is in Python. # get result of a/b without using a "divide" operator def div(a,b): if a < b: return 0 else: return div(a-b, b)+1 This is how human being do the division naturally, however, the running time of this is O(n/m), where n is the size of a, and m is the size of b, which means, O(n/m) is guaranteed to be less than O(n), when m is larger than 1. -MaximThe answer above is still O(n). We can use binary search and find the answer in the interval [1,a] and use multiplication operator.Totally agree with Vasil. Other option: Long Division Algorithm. O(log n) anyway.Show more responseswhy not just a * b^(-1) :-)// Write a function that divides one number by another, without using the division operator, // Assume that x%y = 0 // O(log n) (function() { 'use strict'; var divide = function(x, y) { var xLength = (x + '').length; var i = 0; var result = 0; var xAry = ('' + x).split(); var xStart = ''; for (i = 1; i = y) { xStart -= y; result = parseInt(result, 10) + 1; } } } return result; }; console.log(divide(1000, 4)); })();Use logarithms? O(1) log(x/y) = log(x) - log(y) = log(answer) answer = 10 ^ log(answer)Convert the number to divide into the base of the number that you are dividing with and then shift the 'bits' to the right by 1 then convert back to decimal

### Firmware Developer at Sierra Wireless was asked...

19 Dec, 2012
 Why is a manhole cover round?3 AnswersIt's a Microsoft interview question to get you to think.Hi, is there any technical question? ThanksDepends on who interviews you. They might write some C code up on a whiteboard and you get to tell them what it does and or what is wrong with it. 2nd Interview is usually to see if you will make a good fit within the environment/culture of the team(s). As long as you can show that you can think or have a basic understanding, all is good.

13 Oct, 2010
 How to multiply a number by 7 without using + and * operators?3 Answersuse bit shifting.n=n<<3-ndo the left.bit shift operation by 3 and then subtract the result by original number . eg: n=1 ,then n=n<<3 -n gives 7 , if n=2 ,then gives 14

### Associate Software Engineer at Electronic Arts was asked...

9 Apr, 2009
 Given 100 white marbles and 100 black marbles and two jaws. Put these marbles in the two jars in a way that would maximize the chance of retrieving a white marble from any given jaw.4 Answersdivide black marbles into the two jars first. then divide the white marbles on top of that in the two jars.Really that is what you would answer? What if they stirred the jars around after you distributed the marbles? Personally I think a better answer is to put 1 white marble in the first far and 99 white marbles and 100 black marbles in the second jar. If you choose the jar at random you now have a 74.87% chance of getting a white marble, regardless of the marbles position in the jar.qq is right, that is the optimum combination.Show more responses2 colours, 2 jars. White in one, black in the other

### Investor Services at Orbis Investments was asked...

28 May, 2013
 Brain teaser. You have an infinite amount of water, a 3L jug and a 5L jug. How do you measure out exactly 4L of water. And no their is no 3rd container to collect it in and no lines on the jugs measuring each litre.3 AnswersFill the 3L jug to the top and then empty it into the 5L jug. Then fill the 3L jug to the top again and pour it into the 5L jug until the 5L jug is full. Now you're left with 1L in the 3L jug. Empty the 5L jug and pour the single liter from the 3L jug into the 5L jug. Now just fill up the 3L jug and pour it into the 5L jug leaving a total of 4 liters in the 5L jug.Alternatively, fill 5L to top, then pour 3L off into 3L jug. Empty 3L jug and pour 2L from the 5L jug into it. Refill 5L then pour the contents of 5L into rest of 3L jug until full, i.e. pour off 1LHalf of each container. 2.5+1.5=4

### Summer Intern at KPMG was asked...

10 Nov, 2012
 No very difficult questions. Just be sure you know why you want to work at KPMG (over the other Big 4) and why you want to be a CA2 AnswersThe Peopleso, please tell me how to answer this question: "Why KPMG?" on their website they say benefits yada yada yada , things you cant say why in the interview, please email me: etalkdaily@gmail.com thanks

### Sales Expert at Mexx was asked...

3 Feb, 2012
 What u will do: 2 people on the floor...and 30 customers around2 AnswersWell lady just divided !!!!!I have the same ridiculous question, and my anser was: Of course "we can do it"!!! How a Company like it this can have and "unprofessional interviu tactis"?
110 of 11,329 Interview Questions