Write code to output the no. of times each number appears in two unsorted arrays

Given two strings of unsorted integers write code to output the no. of times each number appears in both arrays. In the sample below number 2 appears 3 times
Sample Arrays:
array #1 [2,21,4,56,12,10,8,2,12,10,21]
aray #2 [12,8,2,10,56,12,8,8,12,4,12]

Showing Answers 1 - 4 of 4 Answers

preet

  • Sep 19th, 2017
 

Code
  1. span style="color: #0000ff;">"unused""unused"" "+" "+"Repeated "+c+" times");

  2.                         c=0;

  3.                 }

  4.  

  5.        

  6.         }

  7. }

  8.  

  Was this answer useful?  Yes

Ashwary Naveen

  • Jan 15th, 2018
 

Ans

Code
  1. span style="color: #006699;">temp"num "+i+ " comes "+out[i]+" times.");

  2.          }

  3. }

  4. }

  5.  

  Was this answer useful?  Yes

Rita

  • May 10th, 2018
 

Write code to output the no. of times each number appears in two unsorted arrays

Code
  1. span style="color: #0000ff;">" " + " " + "Repeated " + counter

  2.                                         + " times");

  3.                         counter = 0;

  4.  

  5.                 }

  6.  

  7.         }

  8. }

  Was this answer useful?  Yes

Shabana Khan

  • May 18th, 2020
 

2 --> 3
21 --> 2
4 --> 2
56 --> 2
12 --> 6
10 --> 3
8 --> 4

Code
  1. span style="color: #0000ff;">" --> "

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions