What is the most efficient way to test for duplicates in a user inputted array?
问题 I am trying to write a simulator for playing the Powerball lottery , where the program would ask for 5 numbers (aka the white balls) and be inputted into a 6 element array and another number (the red Powerball) into the 6 th element. I need to figure out how to test for duplicates in the first 5 elements but the 6 th doesn't need to be unique. I have a loop that I thought would work but it doesn't even execute and is rather messy. Is there a more efficient way to test for duplicates, maybe