Skip to main content
Commonmark migration
Source Link

#Japt, 16 15 bytes

Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases


##Explanation [ ] :Create an array containing U : The input and Uy : The input transposed ® :Map each Z ð : Indices of elements where d : Any element is truthy (not 0) = ) : Reassign to Z Î : First element a : Absolute difference with ZÌ : Last element Ä : Plus 1

Explanation

[   ]               :Create an array containing
 U                  : The input and
  Uy                : The input transposed
     ®              :Map each Z
       ð            : Indices of elements where
        d           :  Any element is truthy (not 0)
      =  )          : Reassign to Z
          Î         : First element
           a        : Absolute difference with
            ZÌ      :  Last element
              Ä     :   Plus 1

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases


##Explanation [ ] :Create an array containing U : The input and Uy : The input transposed ® :Map each Z ð : Indices of elements where d : Any element is truthy (not 0) = ) : Reassign to Z Î : First element a : Absolute difference with ZÌ : Last element Ä : Plus 1

Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases


Explanation

[   ]               :Create an array containing
 U                  : The input and
  Uy                : The input transposed
     ®              :Map each Z
       ð            : Indices of elements where
        d           :  Any element is truthy (not 0)
      =  )          : Reassign to Z
          Î         : First element
           a        : Absolute difference with
            ZÌ      :  Last element
              Ä     :   Plus 1
added 509 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases


##Explanation [ ] :Create an array containing U : The input and Uy : The input transposed ® :Map each Z ð : Indices of elements where d : Any element is truthy (not 0) = ) : Reassign to Z Î : First element a : Absolute difference with ZÌ : Last element Ä : Plus 1

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases


##Explanation [ ] :Create an array containing U : The input and Uy : The input transposed ® :Map each Z ð : Indices of elements where d : Any element is truthy (not 0) = ) : Reassign to Z Î : First element a : Absolute difference with ZÌ : Last element Ä : Plus 1

added 485 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it

#Japt, 16 15 bytes

[UUy]®=ðd)ÎaZÌÄ

Try it or run all test cases

Post Undeleted by Shaggy
added 5 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
Post Deleted by Shaggy
deleted 462 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
deleted 35 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
added 492 characters in body; added 5 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading