govind53's blog

By govind53, history, 5 months ago, In English

Need help with figuring out best possible solution for this problem: There are two strings of same length representing numbers, we can swap the elements at corresponding index in both strings. There exist some integer k such that k swaps results in strings with minimum absolute difference. Task is to find k. Example of one of possible swap: s = "123" and t = "456" -> swap at index 0 makes s = "423" and t = "156" -> abs diff is 267 a possible solution is using back tracking but there should be better solution for this.

A follow-up question, given some k we want to find minimum possible absolute difference after k swaps.

Full text and comments »

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

By govind53, history, 6 months ago, In English

There is a network graph given, in which we need to remove few edges to form at the most k connected components. Resulting graph should have minimum possible bandwidth (by bandwidth we mean maximum number of data packets which can pass through the graph). We need to identify the minimum bandwidth possible. Can someone please suggest possible approach to solve this problem?

Full text and comments »

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