So I've solved this Kata all except for the last character in the string. My solution compares each character in the string to each one after it (to avoid comparing it to itself). However with the last one, there is nothing after it to compare to so it thinks that it's always a unique character. What are some ideas that could solve this problem?
The problem is that on your very first line you're trying to assign an integer "n" to be the length of a string. Also, you have "n" as just an integer right now, not an array of integers.
So, you need to figure out how to convert a string into an array of integers.
Here is one algorithm that could accomplish that:
Convert a string into an array of characters
Convert the array of characters into an array of integers
Compare the contents of the array of integers to find the largest and smallest
Return the result
It looks like you have a handle on how to do steps 3 and 4, but you're missing steps 1 and 2.
So I've solved this Kata all except for the last character in the string. My solution compares each character in the string to each one after it (to avoid comparing it to itself). However with the last one, there is nothing after it to compare to so it thinks that it's always a unique character. What are some ideas that could solve this problem?
I completed it, apparently I had to put in using System. I thought it would implement that automatically, as every c# program uses that.
It does not work how?
Codewars is able to "process" System.Linq, you just need to put appropriate usings in your solution.
This comment is hidden because it contains spoiler information about the solution
The problem is that on your very first line you're trying to assign an integer "n" to be the length of a string. Also, you have "n" as just an integer right now, not an array of integers.
So, you need to figure out how to convert a string into an array of integers.
Here is one algorithm that could accomplish that:
It looks like you have a handle on how to do steps 3 and 4, but you're missing steps 1 and 2.