a clothing store is having a sale on socks. the original price for a package of socks was $12.20. the new price is $9.67. what percentage was saved by buying the socks on sale?
Answers
Answer:
sockMerchant consits following parameter:
n: number of socks in the pile
ar: colors of each sock
Input Format
First line has an integer
Second line has space-separated integers
Constraints
where
Output Format
Total number socks that John sell.
Sample Input
9
10 20 20 10 10 30 50 10 20
Sample Output
3
Step-by-step explanation:
static int sockMerchant(int n, int[] sockArray) {
int matchCount = 0;
int currentColor = 0;
int length = sockArray.length;
ArrayList<Integer> sockColorsArray = new ArrayList<>();
for(int i = 0; i < length; i++){
currentColor = sockArray[i];
if(sockColorsArray.contains(currentColor)){
matchCount++;
sockColorsArray.remove(new Integer(currentColor));
}else{
sockColorsArray.add(new Integer(currentColor));
Answer:
(2.53×100)÷12.20=20.74%