sir i am practicing a question of permutation but i am not able to understand the implementation of the question. please tell me how can i solve this question. and how to write code for it.
question link–> https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/practice-problems/algorithm/permutation-again/
Permutation problem
hello @tejuschaturvedi0
editorial of the question is already given. please read it.
after that u just need one if else statement to implement it.
if(n==1):
print('1')
else if n%2!=0:
print((n*n-3)//2)
else:
print((n*n-2)//2)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.