These are chat archives for Codewars/codewars.com/kata-solving-help

6th
Dec 2016
Ze-Marcos
@MarkSchemmer
Dec 06 2016 17:34
a link to the problem I am struggling with. (https://www.codewars.com/kata/moves-in-squared-strings-i/train/csharp)
The code snippet as well.
using System;
using System.Linq;

public class Opstrings
{
    public  static string VertMirror(string strng)
    {
           var q = strng.Split('\n').Select(x => new string (Enumerable.Range(1, x.Length).Select(i => x[x.Length - i]).ToArray()));

            string t = "";

            foreach (var item in q)
            {
                t += item + "\n";
            }

            t = t.TrimEnd('\n');
            return t;
    }

    public  static string HorMirror(string strng)
    {
            string s = "";
            var query = strng.Split('\n').Reverse().ToArray();

            foreach (var item in query)
            {
                s += item + "\n";
            }

            s = s.TrimEnd('\n');
            return s;
    }

    public static string Oper( Opstrings.fct, string s )
    {
       Opstrings.fct(s);
    }
}
if someone could please help
I know I am doing something wrong.
Please private message me thank you.
Ze-Marcos
@MarkSchemmer
Dec 06 2016 17:55
Never mind everybody I solved it, I read a nice article and I got what I needed to do (http://stackoverflow.com/questions/3622160/c-sharp-passing-function-as-argument)
but thank you all anyways
Love this community
you all are great people
Natacha Beck
@natacha-beck
Dec 06 2016 17:56
and thanks for the link ;)
I cannot help in C# sorry...
Ze-Marcos
@MarkSchemmer
Dec 06 2016 17:57
it's all good really
@natacha-beck thanks anyways
really
I want to post my final solution but
I do not think that would be a good idea.
Annika
@shinda_yume_twitter
Dec 06 2016 18:00
Why not?
Natacha Beck
@natacha-beck
Dec 06 2016 18:00
Because we can cut and paste ;)
I waaaaaant it (joke)
Annika
@shinda_yume_twitter
Dec 06 2016 18:01
I thought he doesn't want to post it on kata solutions. I get why he doesn't want to do it here :)
Ze-Marcos
@MarkSchemmer
Dec 06 2016 23:50
I could really use help please
here is the link to the problem
and my code snippet
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;

public static class Kata
{

  public static long NextSmaller(long n)
  {
             string order = n.ToString().ToCharArray().OrderBy(x => x).Aggregate("", (cur, nex) => cur + nex);
             var query = Enumerable.Range(1, (int)n - 1).OrderByDescending( i => i );

            foreach (var item in query)
            {
                string z = item.ToString().ToCharArray().OrderBy(x => x).Aggregate("", (cur, nex) => cur + nex);

                if ( order == z )
                {
                    Console.WriteLine($"The next lowest number from {n} is {item} ");
                    return item;
                }
            }
            Console.WriteLine("There is no next lower number so we return : -1");
            return -1;
  }
}
I am stuck I am getting an error as well
System.ArgumentNullException : Value cannot be null.
But I do not know how Value is null
I am getting only testing in the test cases and I do not see a null value