1. A bank requires the PINs for their ATM cards to be a sequence of digits without repetition. For example, 5632 is a valid PIN and 4543 is not a valid PIN. Write a program to create a random PIN without repeated digits, given the length of the PIN.
2. A key array of an ordering of the digits 0 to 9 can be used to encode an array of integers in the range of 0 to 9. Write a program that replaces the numbers in an
integer array with each number’s index in the key array. For example, if the key array, as
an ordering of the digits 0 to 9, is 9 0 1 2 8 4 7 5 6 3, then the integer array {3, 5, 1} will
be encrypted as {9, 7, 2} because 3 is at index 9 in the key array, 5 is at index 7, and 1 is
at index 2.


0 comments