Ad
  • Custom User Avatar

    .Length returns the total length of the string starting from 1. We need to access the index which begins at 0. If we wanted to access the last index of the original string it would be Length-1. Since we want to cut the last character off, we use -2. Hope that helps

  • Default User Avatar

    C:

    • unehlpful assertion messages
    • input should be const int[24]
    • memory model of the returned pointer is not explained
  • Default User Avatar

    C:

    • input should be const int[16]
    • unhelpful assertion messages
    • the memory model for the output is not explained
  • Custom User Avatar

    Important!
    Error could say - wrong sorted result, but actually it could be wrong math calculation. Spent a lot of time.

  • Custom User Avatar

    not a kata suggestion

  • Custom User Avatar

    It's been veeery long ago :-))) Thank you for explaining the rule book, @B1ts! ๐Ÿ™

  • Custom User Avatar

    Have you played poker? :P In this case it's point #3. 5 cards are involved in final ranking, and in this case it's the last card that matters (5 > 4), as the pair and 2/3 high cards were equal (suit doesn't matter in this example).

  • Custom User Avatar

    Poker question no. 1:
    it("Highest pair wins", function() { assert(Result.loss, "6S AD 7H 4S AS", "AH AC 5H 6H 7S");});

    --> Is this an error in the test cases? (the pair is equal: both have a pair of aces)

    --> Is this saying that only in case of an equal pair, the suit is relevant? (clubs beats spades)

    --> Is this saying that in case of an equal pair, the highest card is deciding? (5 beats 4)

  • Custom User Avatar

    Ohhhh, thanks, nice explanation

  • Custom User Avatar

    If you pass 0 to the function, it will return -0 yes, but when you try to display -0 (for example, with console.log(-0)), it will appear as 0. This is because JavaScript generally doesn't distinguish between 0 and -0 in the output.

  • Custom User Avatar

    Go preloaded tests are not quite right. It doesn't correctly pick up the set variables clues and expected. I assume because the examples run after all lines of the Describe are evaluated, so the way it's done it only runs with last clues and examples. Could we move setting these variables inside the It?

    var _ = Describe("Sky Scraper", func() {
      
      It("can solve 6x6 puzzle 1", func() {
        clues := []int{ 3, 2, 2, 3, 2, 1,
              1, 2, 3, 3, 2, 2,
              5, 1, 2, 2, 4, 3,
              3, 2, 1, 2, 2, 4}
              
        expected := [][]int{{ 2, 1, 4, 3, 5, 6 },
                { 1, 6, 3, 2, 4, 5 },
                { 4, 3, 6, 5, 1, 2 },
                { 6, 5, 2, 1, 3, 4 },
                { 5, 4, 1, 6, 2, 3 },
                { 3, 2, 5, 4, 6, 1 }}
    
          Expect(SolvePuzzle(clues)).To(Equal(expected))
      })
      
      It("can solve 6x6 puzzle 2", func() {
        clues := []int{ 0, 0, 0, 2, 2, 0, 0, 0, 0, 6, 3, 0, 0, 4, 0, 0, 0, 0, 4, 4, 0, 3, 0, 0}
        expected := [][]int{{ 5, 6, 1, 4, 3, 2 },  { 4, 1, 3, 2, 6, 5 }, { 2, 3, 6, 1, 5, 4 }, 
                { 6, 5, 4, 3, 2, 1 }, { 1, 2, 5, 6, 4, 3 }, { 3, 4, 2, 5, 1, 6 }}            
    
        Expect(SolvePuzzle(clues)).To(Equal(expected))
      })
      
       It("can solve 6x6 puzzle 3", func() {
         clues := []int{ 0, 3, 0, 5, 3, 4, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 2, 3, 3, 2, 0, 3, 1, 0}
         expected := [][]int{{ 5, 2, 6, 1, 4, 3 }, { 6, 4, 3, 2, 5, 1 }, { 3, 1, 5, 4, 6, 2 }, 
                { 2, 6, 1, 5, 3, 4 }, { 4, 3, 2, 6, 1, 5 }, { 1, 5, 4, 3, 2, 6 }}
    
         Expect(SolvePuzzle(clues)).To(Equal(expected))
       })
    })
    
  • Default User Avatar

    I forgot to account for ace-low straights, but I still passed the tests. Maybe that should be stricter.

  • Custom User Avatar

    Never in this kata is it mentioned you're in a game. You just need to compare 2 hands against eachother.

  • Default User Avatar

    having the same issue

  • Custom User Avatar

    image is broken in the description.

  • Loading more items...