Ad
  • Custom User Avatar

    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?

  • Custom User Avatar

    I completed it, apparently I had to put in using System. I thought it would implement that automatically, as every c# program uses that.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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:

    1. Convert a string into an array of characters
    2. Convert the array of characters into an array of integers
    3. Compare the contents of the array of integers to find the largest and smallest
    4. 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.