Java Programming!

5. Modify the previous function to return a list of the indices where these duplicate elements exist. For example, for the ar

5. Modify the previous function to return a list of the indices where these duplicate elements exist. For example, for the array [3, 5, 3, 3, 7 ), your function should return 0, 2, 3 . If there are no duplicates, you should return the empty array 6. Modify the previous function further to support arrays with multiple du plicate elements and return a list of lists of indices. For example, for the array 3, 5, 3, 3, 7, 4, 5 ], your function should return [[0, 2, 3 , [ 1, 6 . If there are no duplicates, you should return the empty array []. 7. Write a function to remove all negative values from an array. For example, for the array 2, -5, 7, -3, -2, 8 ], it should return 2, 7, 8 ] 8. (Monte Carlo sampling) Run your two dice rolling function (Miscellaneous #3) 1,000,000 times and keep track of the results of each roll. Compute the probability of rolling each of the values from 2 to 12



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *