Problem Create a program that uses Luhn’s Algorithm to identify if the input number is a valid credit card number for AMEX, MASTERCARD, and VISA. Breaking Down the Problem Basic Characteristics of Credit Card Numbers 1. The numbers have specific **digits** (AMEX: 15, MASTER: 16, VISA: 13 or 16 ) 2. The **first two digits** of the number are also specific (AMEX: 34 or 37, MASTER: 51~55, VISA: 40~49) Luhn’s Algorithm Not only does the number have to fit the requirements above, it also needs to be validated through Luhn’s Algorithm which is as follows:
Situation Solving the following task on Programmers (Link) Task An interger array ‘numbers’ is given. Create a function that returns an array consisting of sums of 2 numbers of different index sorted in an ascending order.
Resitrictions The length of ‘numbers’ is between 2 to 100. All of the numbers of are bewtween 0 to 100. Input/Output example numbers result [2, 1, 3, 4, 1] [2, 3, 4, 5, 6, 7] [5, 0, 2, 7] [2, 5, 7, 9, 12] My Approach to the Solution Initially Logic Sort the input array in ascending order => loop through the array using forEach => in each iteration, map the array, adding the current value to the array => add all that to a result array => using Set, pick out unique values