MathK30's blog

By MathK30, history, 18 hours ago, In English

Hi guys,

I encountered a problem requiring us to find how many "Double Palindromes" are in the given input String.

A "Double Palindrome" is a string of concatenation of two palindromes with the same size. For example, "aabb", "aaaa" are the "Double Palindromes", but "abba" or "aaaabb" are not. Given an input string, the task is to calculate how many "Double Palindromes" exist in it. On the other word, our task is to calculate how many distinct pairs (l, r) satisfy the condition that S(l)S(l+1)...S(r) is "Double Palindromes".

Sample Input : "abacac" then output will be 6 because of : "ab", "ba", "ac", "ca", "ac" and "abacac" are "Double Palindromes".

Sorry for the missing: n <= 500000

Full text and comments »

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

By MathK30, history, 10 months ago, In English

Hi Guys.

I meet a problem which we have to build a graph of n vertices such that the number of edges is minimized and among 3 vertices i j k, we have a least one of the edge i j, i k, or k j.

I think the solution would be to create 2 complete graphs, each with n / 2 vertices. But I can't prove that partitioning all n vertices into one complete graph and then removing some unnecessary edges is not more optimal than this. Please help me ToT.

Full text and comments »

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

By MathK30, history, 2 years ago, In English

Hi guys, i have 2 vector needed merge. How can I find min dictionary order of vector after merge.

ex : A = {2, 3} B = {4, 5}

one of satis way is : {2, 4, 5, 3}, opposite {3, 2, 4, 5}, {3, 2, 5, 4} is not.

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it