Questions d'entretiens - Engineer | Glassdoor.ca

Questions d'entretiens - Engineer

6,161

Questions d'entretien de Engineer partagées par les candidats

Le top des questions d'entretien

Trier: PertinencePopulaires Date

1. In JavaScript, write a function that takes an array as input that can contain both ints and more arrays (which can also contain an array or int) and return the flattened array. ex. [1, [2, [ [3, 4], 5], 6]] => [1, 2, 3, 4, 5, 6] 2. Using HTML and CSS, show how you would create an image that would display another image (aligned to the bottom, right) when the user hovers over the image. ex. The Facebook "edit profile picture" icon

13 réponses

1.Flatten an array using JavaScript : var flatten = function(input, output) { if(!output) output = []; var i= 0, l= input.length; for (; i < l; i++){ var value = input[i], isArray = toString.call(value) === "[object Array]"; if(isArray) { flatten(value, output); }else { output.push(value); } }; return output; } var arr = [4, [3, 6, [9, 1, 9, [5, 1]]], 8, [5]]; console.log(flatten(arr)); 2. Use CSS Sprites.

var flatten = function(arr, resultArr) { var result = resultArr || []; for(var i = 0; i < arr.length; i++) { if(Array.isArray(arr[i])) { flatten(arr[i], result); } else { result.push(arr[i]); } } return result; };

/* * Similar to Vinnie's answer, but more performant with fewer accessors */ function flattenArray(arr, dest) { var flatArray = dest || [], n = arr.length, i, val; for (i = 0; i < n; i++) { val = arr[i]; if (Array.isArray(val)) { flattenArray(val, flatArray); } else { flatArray.push(val); } } return flatArray; }

implement sqrt without using math libray

9 réponses

Recently I attended the interview at Google and I was asked "You are given a sorted list of disjoint intervals and an interval, e.g. [(1, 5), (10, 15), (20, 25)] and (12, 27). Your task is to merge them into a sorted list of disjoint intervals: [(1, 5), (10, 27)]."

9 réponses

Write a function that divides one number by another, without using the division operator, and make it better than O(n).

7 réponses

Guessing game - I pick a number between 1 and 100 and you are trying to guess it. Every time you query a number I tell you if it is higher or lower. Part 1- Write the code of it, if cost of querying a number is equal. Part 2- How about if cost of querying number x is x? How would you change the algorithm?

7 réponses

Take a paragraph as Input and output the top three most repeated words

6 réponses

Given a Binary Search Tree with integers at every node and an integer k, write code that decides whether or not there exists two nodes a and b such that a+b=k

5 réponses

Do you have experience about the job you are applying for

5 réponses

A few questions on basic command-line syntax in Unix shells: 1. How would you log output and error messages from a command to a file? 2. How would you run the same command on every file in a directory? 3. How would you find the PID of a named process (say if you wanted to kill it)?

5 réponses

describe a time when you had to make a hard decision.

11 réponses
110 de 6,161 Questions d'entretien d'embauche