Home > Back-end >  How do great god this using JAVA implementation, please?
How do great god this using JAVA implementation, please?

Time:03-19

Set a: "1, 2, 1, 1, 4, 5, 1, 2, 3, 2, 5 2, 6, 3, 4, 3, 5, 6 4, 5, 4, 6, 5, 6" like 1, 2 of which are in an array, a set of array fixed!
Collection of b: "1 2,4,6,7,5,8,9,3,4,6,5,7,9,4,6,9,4,6,7 2 3 2 1,34,6 5,7,8,9,7,8,9 1,5,8,9... "One similar 1,5,8,9 array, set b is randomly add four 1 to 9 of different digital array,
Requirements: 1, int a CNT arrays of b for the last time to add the collection reverse comparison! Last time appear, not the array + 1, until in the array, a new collection of c, the maximum number added to the collection of c! Encountered the same array is only counted as one times!
Int a cnt2
With the figures in the new collection with a set of array, if a set an array with the number, the cnt2 zero, no cnt2 + 1, a new collection of d, the cnt2 maximum number added to the set d, corresponding collection a array!
Example:
New a collection c,
Last for 1,5,8,9 array, reverse comparison, the last time for 5,7,8,9 not the array, the CNT + 1, continue to the next set of 5,7,8,9 keep pace with a group, the CNT is not zero, also don't add a, has been compared to appear, finally CNT is 5, add 5 to a new set of c!
With 5 compared with set a collection of c, including: 1, 2, 3, 5, 5, 6 contains the four array cnt2 as zero, other array + 1, save the maximum number of each array! Print!

  • Related