Hackerrank test problem

Правка en3, от search_fool, 2020-12-20 16:57:19

Hi community. I was giving test for some hiring test. The problem says given an array of size N and numbers from 1...M find number of ways to create the array with the followings restrictions. 1) a[i]≠a[i+1] 2) a[1]=a[N] (1 based index) Constraints 3<=N,M<=10^18 I was came up with formula M*(M-1)^(N-3)*(M-2) n>3 and M*(M-1) n==3 But it gave WA. Any suggestions. Thankyou in advance.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский search_fool 2020-12-20 16:57:19 1 Tiny change: 'M-1)^(N-3) *(M-2) n>' -> 'M-1)^(N-3)*(M-2) n>'
en2 Английский search_fool 2020-12-20 16:53:39 9 Tiny change: 'me hiring problem. The prob' -> 'me hiring test. The prob'
en1 Английский search_fool 2020-12-20 16:52:52 428 Initial revision (published)