toilanvd_HUST's blog

By toilanvd_HUST, 10 years ago, In English
  • When solving this problem: http://www.codechef.com/problems/MARCHA6, I got an issue, that is: Let 2 binary strings A and B. With every index i of string A, calculate the max matching of string starting from i and string B. For example:
  • A= 1 0 1 1 0 0 1 1 1 0
  • B= 0 1 1 1 0 1
  • with i= 1 -> max matching= 0
  • i= 2 -> max matching= 3 (it is '0 1 1')
  • i= 3 -> max matching= 0
  • i= 4 -> max matching= 0
  • i= 5 -> max matching= 1 (it is '0')
  • Could anyone tell me how to solve it in O(n)?
  • Thank you! Sorry for my poor English.

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

»
10 years ago, # |
  Vote: I like it +6 Vote: I do not like it