Paypal OA question
Anonymous User
3509

There was a string of size n having certain number of question marks ( k) k can be 0 , your task is to return the number of valid strings formed pertaining to the conditions

  1. No 2 adjacent characters should be same
  2. The first and the last character should be same

for example
abbc has answer =0 as first and last character are different
??lz has answer =24 as the first ? has to be z and the next one has 24 choices

note: only lowercase characters are permitted

n<=10^5

Comments (3)