Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

77%
+5 −0
Challenges Truthify an array

Jelly, 2 bytes ŒṪ Try it online! 1-indexed, but the footer converts to 0-indexed. Less built-in: Jelly, 3 bytes œẹ1 Try it online! œẹ All multidimensional indices of 1 one. ...

posted 3y ago by Unrelated String‭

Answer
#1: Initial revision by user avatar Unrelated String‭ · 2021-01-27T00:40:48Z (about 3 years ago)
# [Jelly], 2 bytes

    ŒṪ

[Try it online!][TIO-kkeoqel6]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kkeoqel6]: https://tio.run/##y0rNyan8///opIc7V/0/3P6oac2jhpn//0dHG@oY6BiCoUFsrA6UD2TAaAOIDAA "Jelly – Try It Online"

1-indexed, but the footer converts to 0-indexed.

Less built-in:

# [Jelly], 3 bytes

    œẹ1

[Try it online!][TIO-kkeoqods]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kkeoqods]: https://tio.run/##y0rNyan8///o5Ie7dhr@P9z@qGnNo4aZ//9HRxvqGOgYgqFBbKwOlA9kwGgDiAwA "Jelly – Try It Online"

```
œẹ     All multidimensional indices of
  1    one.
```

Less built-in:

# [Jelly], 7 bytes

    J,Ɱ"T€Ẏ

[Try it online!][TIO-kkeorhym]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kkeorhym]: https://tio.run/##y0rNyan8/99L59HGdUohj5rWPNzV9/9wO5DxqGHm///R0YY6BjqGYGgQG6sD5QMZMNoAIgMA "Jelly – Try It Online"

```
 ,Ɱ        Pair each
    T      truthy index
     €     from all rows
J  "       with the indices of the rows.
      Ẏ    Flatten rows.
```

The absolute least built-in:

# [Jelly], 8 bytes

    Jx),€"JẎ

[Try it online!][TIO-kkep05j5]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kkep05j5]: https://tio.run/##y0rNyan8/9@rQlPnUdMaJa@Hu/r@H24HMh81zAz9/z862lDHQMcQDA1iY3WgfCADRhtAZAA "Jelly – Try It Online"

Outputs each index backwards.

```
Jx          Repeat each index by the corresponding element
  )         for each row.
   ,€"J     Pair each remaining index with its row index.
       Ẏ    Flatten rows.
```