A riddle for you lot

Discussion in 'Technology' started by Noam, May 5, 2014.

A riddle for you lot
  1. Unread #1 - May 5, 2014 at 2:48 PM
  2. Noam
    Joined:
    Jul 27, 2011
    Posts:
    2,993
    Referrals:
    1
    Sythe Gold:
    0
    Discord Unique ID:
    688859853535313930
    Discord Username:
    sarbaz#8969
    Two Factor Authentication User Gohan has AIDS

    Noam Apostle of the Setting Sun
    $50 USD Donor New Competition Winner

    A riddle for you lot

    F(string s, string b) returns the number of appearances of b as a substring of s times len(b).

    Given an arbitrary string s, find a palindrome b for which F(s, b) is maximal in time O(n log n) where n = len(s)


    Example: For the string "aaa"
    F("aaa", "a") = 3*1 = 3
    F("aaa", "aa") = 2*2 = 4
    F("aaa", "aaa") = 1*3 = 3

    Hence the solution is "aa"
     
< Keyboard and mouse not working | Some media not loading? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site