5 kyu

Line Safari - Find the end points

Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • Alexenon Avatar

    Input

     *******
     *
     ****
     *
     *******
    

    Expected

    X*****X
    *
    ?**X
    *
    X*****X
    

    Can somebody explain me why char '?'(question mark), is an endpoint ?
    Its in the center of the 3 lines, connecting 2 oposite lines {UP with DOWN}

  • dinglemouse Avatar

    @dfhwze, thanks for approving!

  • Blind4Basics Avatar

    not sure if it's an issue or not, but...

    There are no test cases with ambiguous answers

    while these look like ambiguous "non diagonals":

    *****x*    
    *     x    
    *  ****x***
    *  *  *   *
    *  *  *   *
    **x****   *
       x      *
       *x******
    
    ------------------------
    
    Expected:
    
    X*****X    
    *     *    
    *  X******X
    *  *  *   *
    *  *  *   *
    X*****X   *
       *      *
       X******X
    
    Your solution:
    
    X****XX    
    *     *    
    *  X***X**X
    *  *  *   *
    *  *  *   *
    X*X***X   *
       *      *
       XX*****X
    

    => either this case isn't valid (I pass all other tests), or you need to be more precise about what you mean and you need more tests with this kind of things.

    EDIT: mmmh, well... "You" (I mean "I", actually) will get the same thing with any crossing. Weird I don't get that trouble on other cases. I'll check further. Na, definitely looks like something invalid according to your rules, so far. That or the expected answer is incorrect.

  • ZED.CWT Avatar
    spider
     Log
    Expected:
    
         X             X     
         *             *     
         X             X     
    X     *           *     X
     *     * X*****X *     * 
      *     X       X     *  
       X***X         X***X   
           *         *       
      X***XX         XX**X   
     *     X         X    *  
    X     * *       * *    X 
         *   X     X   *     
        *   * X***X *   *    
       X   *         *   X   
          *           *      
         X             X     
    
    Your solution:
    
         X             X     
         *             *     
         X             X     
    X     *           *     X
     *     * X*****X *     * 
      *     X       X     *  
       X***X         X***X   
           *         *       
      X****X         X***X   
     *     X         X    *  
    X     * *       * *    X 
         *   X     X   *     
        *   * X***X *   *    
       X   *         *   X   
          *           *      
         X             X     
    

    Why X***XX XX**X?