Random substring generator


  • 0
    W

    Generate random substring of length k from a given string with equal probability. For example, string tree has 7 substrings with length of two, tr, te, ee, rt, et, re, er. The function should return any one of them with the probability of 1/7


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.