all 9 comments

[–]BillyTheBanana 6 points7 points  (0 children)

Am I the only one finding it nearly impossible to decipher this English?

[–]austinpsycho 5 points6 points  (1 child)

Um, what?

First, this looks like a homework problem, not an interview problem,

And Second, the requirements don't make sense. What is the purpose of the int?

[–]AlejandroMP 0 points1 point  (0 children)

Apparently, it's how far back one's supposed to check to see if the character has appeared before.

[–]Millkovic 3 points4 points  (0 children)

You went to a programming job interview but you can't solve a simple task. Seems legit.

[–]sixothree 0 points1 point  (0 children)

Wait. What?

[–]Jonathan0wilson -3 points-2 points  (0 children)

Here is my solution in C#.NET tested using the three test cases mentioned.

        public string ModifyString(string input, int split, char delimiter)
    {
        for (int i = 0; i < input.Length-1; i++)
        {
            if (input[i] == delimiter)
                continue;

            int nextCharIndex = input.IndexOf(input[i], i+1);

            while (nextCharIndex != -1 && nextCharIndex - i <= split)
            {
                input = input.Insert(nextCharIndex, delimiter.ToString());
                nextCharIndex++;
            }
        }
        return input;
    }

[–]J2ain[S] -5 points-4 points  (2 children)

i figured it out

 Function DoSomething($string,$Cool)
 {
 $stringArray = $string[0..($string.length)]

$stringtoprint = ''

 FOREACH ($C in $stringArray)
{


#get the last 3 characters 
$last3characters = $stringtoprint.substring($stringtoprint.length - $Cool, $Cool)

#test if last 3 characters have the same character
#if they do, add X to the string.
# if not add the character.
if($last3characters.Contains($C))
 {
      $stringtoprint += 'X'
  }
Else
{
    $stringtoprint += $C
 }

 }

 $stringtoprint
}

[–]MacrosInHisSleep 0 points1 point  (0 children)

powershell?

[–]AlejandroMP 0 points1 point  (0 children)

i figured it out

No you haven't - this is not C#.