trailblazer995's blog

By trailblazer995, history, 4 years ago, In English

Hi, I came across a problem in hackerrank test, the problem statement was:

Given an undirected graph with N nodes and M edges, each edge contains a gadget with id i (where 1 <= i <= G), after that you're given Q queries, in each query you've two nodes u and v, you've to find number of distinct gadgets in all simple paths from u to v. Constraints: 1 <= N, Q, M <= 10^5 1 <= G <= 40 Time Limit: 1 sec

I was unable to solve it and couldn't find a solution on internet as well, can anyone tell how to solve it or whether it's not possible solve it

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By trailblazer995, history, 4 years ago, In English

Hi all, i came across a real life problem where we have N workers and M jobs and edges are given for valid matching with it's weight. Maximum weight matching here can be found using Hungarian's algorithm where complexity will be O(max(N,M)^3). Here N <= 100 and M <= 2000. Can we have some optimisation here for this case such that we don't need to create dummy entries to make MxM matrix? Or is there any other solution?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it