Блог пользователя samadeep

Автор samadeep, история, 8 месяцев назад, По-английски

Permuation Question : Number of Strings with no K consequetive equal letters given the string is made of lower case alphabets

Read here : Explanation It has beautiful solution using recurrence formulaes.

Basically the Recurrence is :
if k == n:    ways[n] = (power(26,k) - 26)
if n <= k - 1:   ways[n] = power(26,n)
else ways[n] = (countValid(n-1,k) + countValid(n-k,k))

You need to take care of modular arithmetic of course as the numbers get really large BTW it was there in Atlassain OA — best OA ever

C++
python
  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
8 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

WHy the downvote my friends ?

»
8 месяцев назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I upvoted.

»
8 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

is this blog really necessary?

  • »
    »
    8 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Its actually something i found interesting as a problem for understanding why permutations and combinations using binomial coefficients are slower than recursive techniques

    Ofcourse on necessity i have no comments its just that i found this interesting Any criticism is welcome.