xljiasjtu
BAN USER
Comments (4)
Reputation 20
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
1、we have a two-dimensional array to represent the adjacent between two vertexes;
also each vertex have a adjacent list of vertexes whose id are larger than the vertex itself;
2、For every vertex list,we check its adjacent vertex pair,and find the reasonable pairs through the 2-dim array;
Time complexity is min(O(edge^2),O(n*d^2));(d represent the degree of the vertex),but I think my solution avoid the redundant computation. A little better than the first solution.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
I think Yash's solution time complexity is also O(N*M).
- xljiasjtu July 15, 2014Like the below example(I saw somebody's example).
target: aab
src: aadaadaadaadaab