Solved

Code a Method That Returns an Int Array That Is

Question 101

Essay

Code a method that returns an int array that is parallel to its array parameter letters. If an element of letters is A, the corresponding element of the returned array is 1; otherwise, it is 0.
Example 1: If the array parameter is A B A, the returned array is 1 0 1.
Example 2: If the array parameter is A B A C D A A, the returned array is 1 0 1 0 0 1 1.
Example 3: If the array parameter is A A E F G, the returned array is 1 1 0 0 0.
public static int [ ] convert( char [ ] letters )
{
// Your code goes here
}

Correct Answer:

verifed

Verified

public static int [ ] convert( char [ ] ...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions