#Why am I getting an error when creating a set of characters from an array of characters?

1 messages · Page 1 of 1 (latest)

zinc field
#

I’m doing an easy leetcode problem where I have to implement a function with a string input that contains distinct characters and a string array.

I’m supposed to output the number of elements in the array that only contains characters that belong to the string input. So I figured that sets would be ideal for such a problem.

However, when I’m trying to convert an array of characters into a set, it gives me this error.

atomic schoonerBOT
#

<@&987246883653156906> please have a look, thanks.

atomic schoonerBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

quick horizon
#

@zinc field can u post an actual screenshot, not a photo? those are quite unreadable

zinc field
#

Here @quick horizon

zinc field
#

I rearranged the code so that it fits the screen, which is why it says line 20 instead of line 14

zinc field
#

Nvm I solved it, turns out I couldn’t use Character, so I used String instead and used the split method