## duskan

BAN USER- 1of 1 vote

AnswersQueue implementation in Java.

- duskan in United States for Ad| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 0of 0 votes

AnswersFind if a given array has any duplicates, with O(n) complexity

- duskan in United States for Ad| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Algorithm - 2of 2 votes

Answers/**

- duskan in United States

* Returns a^b, as the standard mathematical exponentiation function

*/

public double pow(double a, int b) {}

Interviewer looking for log(n) solution, right on first attempt.| Report Duplicate | Flag | PURGE

Linkedin Software Engineer / Developer Algorithm - 1of 1 vote

Answers/**

- duskan in United States

* Given a nested list of integers, returns the sum of all integers in the list weighted by their depth

* For example, given the list {{1,1},2,{1,1}} the function should return 10 (four 1's at depth 2, one 2 at depth 1)

* Given the list {1,{4,{6}}} the function should return 27 (one 1 at depth 1, one 4 at depth 2, one 6 at depth2)

*/

/**

* This is the interface that represents nested lists.

* You should not implement it, or speculate about its implementation.

*/

public interface NestedInteger

{

// Returns true if this NestedInteger holds a single integer, rather than a nested list

public boolean isInteger();

// Returns the single integer that this NestedInteger holds, if it holds a single integer

// Returns null if this NestedInteger holds a nested list

public Integer getInteger();

// Returns the nested list that this NestedInteger holds, if it holds a nested list

// Returns null if this NestedInteger holds a single integer

public List<NestedInteger> getList();

}| Report Duplicate | Flag | PURGE

Linkedin Software Engineer / Developer Algorithm - 2of 2 votes

AnswersDesign a parking lot system where you need to provide a token with the parking space number on it to each new entry for the space closest to the entrance.

- duskan in United States for Sales

When someone leave you need update this space as empty.

What data structures will you use to perform the closest empty space tracking, plus finding what all spaces are occupied at a give time.| Report Duplicate | Flag | PURGE

Apple Software Engineer / Developer Algorithm - 0of 0 votes

AnswersFind median from a stream of flowing numbers

- duskan in United States for Sales| Report Duplicate | Flag | PURGE

Apple Software Engineer / Developer Algorithm

I am not able to understand this question fully. Can someone please explain, what happens if i have the setup like below :

{

{0,1,0},

{1,0,0},

{0,0,0}

}

Why is influncer = 2 here, i understand {2,0} {2,1} are 0's. BUT shouldnt {0,2} and {1,2} be equal to 1, meaning 0,1 are following2, but 2 is not following anyone ... ?

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

- duskan September 05, 2016