Hi,
On codingbat exercise
https://codingbat.com/prob/p190570
Questions:
1) I'm getting the error message
incompatible types: boolean cannot be converted to java.lang.String. I've researched a bit, but I'm not entirely sure why I'm apparently trying to convert a boolean to a String.
2) Also I interpreted they were asking me to code for the following checks:
- the string not to be empty
- the n to be within a certain range
but their solution has no conditions.
The problem reads:
"Given a non-empty string and an int n, return a new string where the char at index n has been removed. The value of n will be a valid index of a char in the original string (i.e. n will be in the range 0..str.length()-1 inclusive).
missingChar("kitten", 1) → "ktten"
missingChar("kitten", 0) → "itten"
missingChar("kitten", 4) → "kittn"
My solution:
Their solution: