R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
Note:
5 bytes are wasted because in rankrank function the default handling strategy forin case of ties is "average their ranks" instead of any other of the other possibilities... argh!
R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
Note:
5 bytes are wasted because in rank function the default handling strategy for ties is "average their ranks" instead of any other of the possibilities... argh!
R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
Note:
5 bytes are wasted because in rank function the default handling strategy in case of ties is "average their ranks" instead of any of the other possibilities... argh!
R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
Note:
5 bytes are wasted because in rank function the default handling strategy for ties is "average their ranks" instead of any other of the possibilities... argh!
R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
Note:
5 bytes are wasted because in rank function the default handling strategy for ties is "average their ranks" instead of any other of the possibilities... argh!
R, (削除) 23 (削除ここまで) 2227 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
R, (削除) 23 (削除ここまで) 22 bytes
any(rank(x<-scan())-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n
R, 27 bytes
any(rank(x<-scan(),,'f')-x)
Returns FALSE for Truthy, TRUE for FALSY (just to shave one byte)
Explanation:
If the array containing the rank of each value is equal to the input array, then it's a permutation of 1..n