Company: Walmart sparkplug
Difficulty: medium
26 Network Station Combinations Two stations A and B are connected to a network. Both stations have N number of addresses each. The network brings the first address X of station A followed by the largest address Y from station B, where X<Y. The possible path includes a combination of the addresses of both stations A and B with the condition that the first address is picked from station A and ends with an address value of station B. For example: Addresses of Station A: {11, 9, 21} Addresses of Station B: {5, 18, 32} Now, initially, 11 is picked from A. Next 18 is picked from B as 18>11. The first combination is (11,18). Next, again 11 and 18 are picked. Now, as 21>18, thus 21 is picked from A. As the path cannot end with an address from A, 32 is also picked from B as 32>21. Similarly, for all addresses, the combinations are to be found. Let there be Z combinations formed. Find the sum of all the addresses in each combination, thus Z sums are calculated. Write a program to find out th