Ad
  • Custom User Avatar

    I love this website because you get to see a lot more of the niche pieces of code, which can be overlooked :)

  • Custom User Avatar

    Thanks alot mate!

    I feel emberased as a C# dev not knowing this xD.
    Knowing this will make me use Linq even more from now :)

  • Custom User Avatar

    Thanks! I'll definitely check it out.

  • Custom User Avatar

    I've done a little googling around the 12000 ms timeout. It seems to be an issue with codewars not with the code. I've had a few puzzles in the past, that should of ran in milliseconds but timedout. https://github.com/Codewars/codewars.com/wiki/Error-messages:-Submission-timed-out

  • Custom User Avatar

    Also because I can't be bothered creating new projects for each puzzle on here. I just have a project called "ConsoleSandbox" on my machine. It only contains code I'm playing with, so if any of it gets deleted I'm not overly concerned.

  • Custom User Avatar

    I like the website: http://linqsamples.com

    Also for learning linq you could try using linqpad. You don't need to write full programs, e.g. classes and methods, you can just write 2 lines of code and it'll work. Personally I found this site the best, as I could write code and see what everyone else was doing. If you need something quick and with intellisense you could install visual studio code. It's lightweight has intellisense to help you (and it's free)

  • Custom User Avatar

    Thanks for the linq solution. Do you know of any good linq sandbox sites or resources I can check out to learn how to use it in my own problem solving?

  • Custom User Avatar

    This is a property which can be pulled through if you want it. I could of named it anything. One the where linq, if you select to name properties (in this case "index"), it will create a property which contains the current interations index. There is another property which can also be pulled through (pretty sure there are 3 properties (1: item of the list, 2: index). Anyway the second name in (n,index) is to reference the index.

    Or as Visual Studio 2017 puts it:
    Filters a sequence of values based on a predicate. Each element’s index is used in the logic of the predicate function.
    Predicate: A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

    Anyway... I know both the Select and Where Linq methods allow you to pull through the index.

  • Custom User Avatar

    If it's not a server problem, then you do actually enter an infinite loop somehow. You could add an operations counter and make it stop the function execution when it reaches some very big value (with a message to stdout ofc) to verify this.

  • Custom User Avatar

    I have it running perfectly locally, but when I attempt it stalls on the following:

    "[>*]", "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

    Instantanous locally, on your system it times out after 12 seconds.

    If I alter the "Run Sample Tests" to contain the attempt stuff it runs perfectly fine. Only fails on the attempt.

  • Custom User Avatar

    how is this working with index? u type as parameter index into the Linq Where querry and C# accepts it as the index??

  • Custom User Avatar

    I found the description on this one was very very poor. It may be because I'm not from America, but the description just says to return a number not to style it, but the test wanted symbols in the result.