## hm

- 0of 0 votes

AnswersDesign a train system which suggests shortest path and transfer needed to reach from source to destination. What can be the optimization.

- hm in United States

For example:

A system may have 10 trains from t1 to t10.

There are total 100 stops in the system s1 to s100.

Each train has fixed set of stops. You could allow to change and transfer train of source and destination does not cover using just 1 train.

What all can be APIs, data structure, optimizations scalable option.| Report Duplicate | Flag

Software Engineer Algorithm Problem Solving Software Design System Design Trees and Graphs design - 1of 1 vote

AnswersGiven an array of task and k wait time for which a repeated task needs to wait k time to execute again. return overall unit time it will take to complete all the task.

- hm in United States

Example:

1. A B C D and k = 3

ans: 4 (execute order A B C D)

2. A B A D and k = 3

ans: 6 (execute order A B . . A D)

3. A A A A and k =3

ans: 13 (A . . . A . . . A . . . A)

4. A B C A C B D A and k = 4

ans: 11 (A B C . . A .C B D A )| Report Duplicate | Flag

Twitter Software Engineer Algorithm - 6of 6 votes

AnswersPost order traversal for an N-ary tree iterative way.

- hm in United States

Given,

struct Node {

int val;

vector<Node*> children;

};

Without modifying original structure.| Report Duplicate | Flag

Google Software Engineer Algorithm C++ Trees and Graphs - 0of 0 votes

AnswersPost order traversal for an N-ary tree iterative way.

- hm in United States

Given,

struct Node {

int val;

vector<Node*> children;

};

To simplify you can modify the structure.| Report Duplicate | Flag

Google Software Engineer Algorithm C++ Trees and Graphs - 0of 0 votes

AnswerWrite a program to get out of the Maze. Maze can be represented in the form of Matrix where x can be represented as wall. and _ can be represented as a path.

- hm in United States| Report Duplicate | Flag

EMC Software Engineer Algorithm - 1of 1 vote

AnswersDesign a data structure which should have following operation. Insert, Delete, Random access

- hm in United States| Report Duplicate | Flag

Google Software Engineer Data Structures - 1of 1 vote

AnswersGiven 2 large number A and B, create a new number C using the digits from A which needs to be grater than B.

- hm in United States

e.g. A = 5281, B = 7443

C = 8125.| Report Duplicate | Flag

Google Software Engineer Math & Computation

agree it should use stack to traverse nodes instead of queue. Revised above logic,

{{

void printPostOrderIterative(TreeNode* root)

{

if(!root)

return;

stack<TreeNode*> store;

stack<TreeNode*> traverse;

traverse.push(root);

while (!traverse.empty())

{

TreeNode* element = traverse.top();

store.push(traverse.top());

traverse.pop();

for (int i = element->children.size() -1 ; i >= 0; i--)

{

traverse.push(element->children[i]);

}

}

while (!store.empty())

{

printf("%d\n", store.top()->data);

store.pop();

}

}

}}

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

Open Chat in New Window

To find kth largest or smallest number, use quick select algorithm. Check out wikipedia.

- hm September 18, 2015