## Yoda

BAN USER- 0of 0 votes

AnswersYoda speaks in a jumbled language. Say " Newyork must go we to now". FInd the minimum number of swaps to convert this to proper sentence say "we must go to newyork now". This is similar to minimum swaps to convert string A to string B. where A, B are permutation of each other? Is there a decisive method? I tried using merge sort and selection sort and both time the answers varied.

- Yoda in India| Report Duplicate | Flag | PURGE

Adobe Computer Scientist Algorithm - 0of 0 votes

AnswersYou are given intervals in form of Interval(i)={a(i), b(i)} where a,b are start and end points on a straight line. Given an array of intervals, Can you determine whether any such pair exist such that Interval(i) is contained in Interval(j). I told them the O(n log(n)) approach. If we have to find how many such pairs exist is it possible to do it in time less than O(n^2)??

- Yoda

What if i also have to print all such pairs??| Report Duplicate | Flag | PURGE

Adobe Computer Scientist Algorithm

In the client program(That is the skype app mobile, skype app web) emit the simple metrics on start end time of the calls.

Then develop a client side metric aggregator library(javascript for browser, android for apps etc). This will just collect the metrics getting logged and throw it to a server. The server application could be exposing an api or simply listening to a queue(SQS if i may). So your client keeps sending this data onto this queue which is read by the server and saved in a data store.

Then you can build a layer on top of this data to interpret your result

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

Open Chat in New Window

Basically you need to find two nodes which are same to start with. And then call the isDuplicate(root1, root2) method on both. This exhaustive traversal is worst case matching of each node with each node and then isIdentical is O(n). Hence the overall complexity is O(n3)

- Yoda May 05, 2018Now any two subtrees can be duplicate only if one is not ancestor of other.