Question: Your task is to find duplicate numbers and print them in reverse order. At first, take two 16 bit variables and store 4 digit 16-bit
Your task is to find duplicate numbers and print them in reverse order. At first, take two 16 bit variables and store 4 digit 16-bit decimal numbers in each of them. Now you have to combine the two numbers and print all the 8 digits in the same line. Next, you have to find the duplicate numbers in this 8 digit number (traverse left to right) and print them in reverse order in new lines. If there are no duplicates, then print No duplicates.
Sample Input 01:
Var 1 = 1684 Var 2 = 3681
So by combining them we get 16843681. You now have to use a suitable data structure where you can store this value
Sample Output 01:
1 6 8 4 3 6 8 1 8
6
1
Explanation:
The numbers that have duplicates are 6, 8, and 1. Now from left to right, 1 appears first, then 6, and then 8. So now we reversely print them as 8 then 6 and then 1.
Sample Input 02:
Var 1 = 7337 Var 2 = 7989
So by combining them we get 73377989. You now have to use a suitable data structure where you can store this value
Sample Output 02:
7 3 3 7 7 9 8 9 9
3
7
Explanation:
The numbers that have duplicates are 3, 7, and 9. Now from left to right, 7 appears first, then 3, and then 9. So now we reversely print them as 9 then 3 and then 7.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
