Ad
  • Custom User Avatar

    You're right. I'll give it some thought and write some. :)

  • Custom User Avatar

    The line (record) terminator is a carriage-return/line-feed combination. If the list is empty, there are no records (i.e. no lines), so there are no CrLfs to terminate them.

    Think about a hypothetical process which is going to take your output as input and interpret it. The first thing it's (probably) going to do is check if the input is empty. If so, it will know there are no records. If not (and if it contains a CrLf, that counts as "not empty"), it's going to try and extract records from it.

    Makes perfect sense to me, and I work with stuff like this all the time: each record must be terminated by a carriage-return/line-feed combination (in fact I often work with requirements where the record terminator is a | or something, meaning it's actually one continuous line in the file, but I digress). If there are no records, there are no record terminators.

    Maybe I should just update the description to make it clearer. :)

  • Custom User Avatar

    Thanks for the suggestion! I'll give it some thought. :)

  • Custom User Avatar

    What a pity I can't upvote more than once. What an awesome post! myjinxin2015, you just made my day. :-)

  • Custom User Avatar

    Because it's not an irrelevant edit in this case; in this case it's very relevant, because as written it just looks like a typo which, when "fixed", means the opposite of what he intended.

    Your "correct grammar" makes the intention clear, but it still seems a bit wordy and clunky, and it would mess up the nice neat "x and y..." format of the other rules above it.

    How about just removing "at least one" and replacing "and" with "or"?

    "material7 or material8 must be selected"

    Ideally, I'd like to see the sentence prepended with the word "Either " too, but again, it would mess up the symmetry, and I like symmetry, so I'm happy to leave it out. :)

  • Custom User Avatar

    I thought that was a typo, and that the description meant "material7 and material8 must be selected at least onCe"

    That's the only way it makes sense. If you want to say that either 7, or 8, or both, must be present, then I would say:

    "Either material7 or material8 must be selected at least once"

    Or maybe

    "There must be at least one instance of either material7 or material8"

    Or even

    "material7 OR material8 must be selected at least once"

    But not the sentence as written. If "at least one" isn't a typo, then that phrase is in the wrong place. If it IS a typo, then the use of "and" implies they must both be present.

    Nonetheless, I did figure it out.

    For anyone reading this, the answer is exactly what I suggested in my OP (Either 7 or 8 must be selected at least once). ;)

  • Custom User Avatar

    Something's not right. In your rules, you say:

    material7 and material8 must be selected at least one

    But then in your example, you say:

    For formula = [1,3,7], The output should be true.

    Why?? [1,3,7] does not contain 8, which breaks your rule. Or, do you mean to say that EITHER 7 OR 8 must be selected at least once?

  • Custom User Avatar

    Okay, I figured it out. But all I can think of is... really? That's it? :(

  • Custom User Avatar

    I dunno. Shuffle it again? But there's always the chance (however infintesimal) you could end up putting it in perfect 2-A order with each suit separated. :P

    But since you didn't intend to do that, would you still consider it an unordered deck if that happened?

    Or is it a Schrodinger's Cat thing, where the next card in the deck is both 2H and not 2H simultaneously?

  • Custom User Avatar

    Ah, so it's more a mathematical concept than a SORTING concept? I guess that's where my confusion probably came in.

    I'm not a maths person. Damn near failed it my last year of High School, and never did any maths after. I tend to avoid Katas that look "mathy" on Codewars like the plague. ;)

    I'll probably still give it a try, but I do think the instructions on this Kata can stand to be clarified, especially with an understanding that not all developers are particularly well-versed in maths.

  • Custom User Avatar

    Hmm....

    That's a difficult concept to wrap my head around. I'll give it some thought--but not too much thought, based on the rank of this Kata. ;-)

    Thanks!

    (Of course, if it's impossible to find any order within it, then the order is, by definition, unpredictable, so it's also impossible to test because there's no "right" answer. Not so?) :P

  • Custom User Avatar

    I guess I have to do some more research. I've been working with SQL Server for over 15 years, and I've never heard the term "unordered" used in this context. I can only assume it means "unsorted", as in, the order the data is stored in the table, unaffected by the use of an ORDER BY or similar clause.

    In that case, to me, returning the data "unordered" simply means doing a straight select with no ORDER BY or JOIN of any kind.

    But the data is always ordered by /something/, typically the primary key, which in most cases is also the UNIQUE CLUSTERED INDEX (although you can remove that CLUSTERED INDEX from the primary key if you want, and put it somewhere else, I don't think very many people ever do that).

    Is this concept of "unordered" something specific to Postgres? Because my experience with Postgres is limited to what I've been exposed to on Codewars. :)

  • Custom User Avatar

    I don't know what you mean by "unordered".

    Can you explain?

    Give me an example of the table contents currently, and another example of how you want the data returned.

  • Custom User Avatar

    Is there a C# test case I can use for nested loops?

    My code keeps timing out, and I can't print the input (my Console.WriteLine instructions aren't getting hit for whatever test is timing out), but I'm fairly certain it's taking too long to process code containing at least one nested loop.

    In Visual Studio, my code runs fine against all the sample tests, and I "Simple Loop" test I devised myself, but I can't find any real-world examples of the kind of test that's causing my solution to timeout on Codewars. :(

    It'd be really great to include such a test in the sample tests for this Kata.

    Edit: Nevermind about the test. I found the bug in my FindMatchingBracket method, which was causing an infinite loop under certain circumstances. I've now successfully completed the Kata.

    It was good, but it took me awhile to wrap my head around the requirements for [ and ]. I'd still definitely like to see a test using those under Sample Tests, and/or clearer instructions for what they mean.

  • Custom User Avatar

    Random tests in C# are broken and suffer from rounding issues. I prefer C#, but had to ultimately solve it in Javascript.

  • Loading more items...