Question: Complete the method countCharkey that accepts two parameters: a 2D array of characters and a char key. The method should return a 1D array of

 Complete the method countCharkey that accepts two parameters: a 2D array

Complete the method countCharkey that accepts two parameters: a 2D array of characters and a char key. The method should return a 1D array of integers where each element in the 1D array represents the number of occurrences of the key in the corresponding row of the 2D array. The rows of the 2D array might not all be the same size (l.e., it might be a "ragged" array). For example, if passed the 2D array [['a', 'b', 'c'), ('a', 'd, 'b', 'a', 'z'], ['w', 'X, 'y' 'z'] ) and the key 'a: the method should return the array: (1,2,0). publie statie int[] countcharkey(char 10 array, char key)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!