Ad
  • Custom User Avatar

    Thank you for the reply, I appreciate the feedback :)

    I understand the implication re a given length having a consistent value throughout a stream (eg if length 5 ), but the bit I quoted seems to imply that a dot can be length 5 at the same time as a dash can be length six, in the same stream?

    Are you saying that's not the case, that dot.length==5; dash.length==6 don't occur simultaneously?

  • Custom User Avatar

    "Consistency means that if in the beginning of a message '11111' is a dot and '111111' is a dash, then the same is true everywhere in that message."

    Would these series be distinguishable then:

    1. short=5, long=6: ".-" -> "1111100000111111"
    2. short=5.5: ".." -> "1111100000111111" [extra "1" through variance]
  • Custom User Avatar

    Thank you for that, thought I was going nuts :)

  • Custom User Avatar

    I passed the sample test but failed when I attempt. To try and debug I'm printing out the bits to console from decodeBits, and this one has me stumped:

    Bits :
    111
    1111111
    110011

    Error:
    expected:<[I]> but was:<[E]>

    I am not seeing how that is supposed to be an "I" which translates to ".." (Morse) or an extrapolation of "101" in binary...which is what the last line is but what about the two lines of 1's above that? Thanks

  • Custom User Avatar

    Is there a good reason to create the sub-function:

    val getJustIntOrRegister = {key: String -> 
            key.toIntOrNull() ?: registers.getOrDefault(key, 0)
        }
    

    rather than:

    fun getJustIntOrRegister(key: String) = key.toIntOrNull() ?: registers.getOrDefault(key, 0)
    
  • Custom User Avatar

    Seems like an ambiguity in requirment? Quoted example:

    solution([-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20]);
    // returns "-6,-3-1,3-5,7-11,14,15,17-20"

    Implies:
    (-3, -2, -1) -> "-3-1"
    (-3, -2, -1, 0, 1) -> "-3-1"

  • Custom User Avatar

    Hi, can you please eli5, I understand the functional steps but I don't see why the lambda(?) seems to be getting run in between

    1. listOf...
    2. joinToString...

    Thank you :)

  • Custom User Avatar

    Thanks, that does help :)

  • Custom User Avatar

    Yes it does help, thanks!

  • Custom User Avatar

    Some questions pls:

    1. Why are variables declared that way "String.words...", rather than usual "val words:String..."?
    2. Did you need to use "private"? Seems to work without?
    3. Any reason no indenting?

    Thanks

  • Custom User Avatar

    Hi, how do I re-subscribe to the weekly challenge email? If I unsubscribed myself? Thanks

  • Custom User Avatar

    Can someone pls comment on how pythonic it is to put the important line just before the return line, within the function?

  • Custom User Avatar

    I'd love to get some feedback and opinions on best practices in managing the connections (edges?) in this incestuous family tree, specifically whether to go with one way connections between child and parent, or two-way connections.

    Obviously 2-way connections make it much easier to navigate the tree but they also double up on connection creation/deletion. 2-way also seems more prone to bugs creeping in as you have to keep the 2-way links synced.

    FWIW I went with one-way (upwards) as it felt "Better" in terms of minimising gaps for the bugs to creep in. On the other hand the top solution used 2-way.

    Thanks!
    p.s. I did not deem this discussion to be a spoiler, my apologies if others disagree

  • Custom User Avatar

    ofc. That's the very basics of writing code that throws/raises... ;p

    Maybe, but this is a learning resource, correct? I'm using it to learn and if I had all the best practice knowledge I wouldn't need to be using this site.

  • Custom User Avatar

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

  • Loading more items...