3 deleted 6 characters in body
source | link

Jelly, 14 bytes

2 bytes thanks to Dennis.

R‘*€¹$+Z$FṢQị@

Try it online!Try it online! (Takes 0m0.950s~ 1s for 82 for me) (ConstantO(n^2) time)

Original 16-byte answer

2r30*€¹$+Z$FṢQị@

Try it online! (Takes 0.947s< 1s for me) (Constant time)

Jelly, 14 bytes

2 bytes thanks to Dennis.

R‘*€¹$+Z$FṢQị@

Try it online! (Takes 0m0.950s for me) (Constant time)

Original 16-byte answer

2r30*€¹$+Z$FṢQị@

Try it online! (Takes 0.947s for me) (Constant time)

Jelly, 14 bytes

2 bytes thanks to Dennis.

R‘*€¹$+Z$FṢQị@

Try it online! (Takes ~ 1s for 82 for me) (O(n^2) time)

Original 16-byte answer

2r30*€¹$+Z$FṢQị@

Try it online! (Takes < 1s for me) (Constant time)

2 deleted 14 characters in body
source | link

Jelly, 1514 bytes

2 bytes thanks to Dennis.

2r⁹*€¹$+Z$FṢQị@R‘*€¹$+Z$FṢQị@

Try it online!Try it online! (Takes 270m0.084s950s for me) (Constant time)

16 bytes, much fasterOriginal 16-byte answer

2r30*€¹$+Z$FṢQị@

Try it online! (Takes 0.947s for me) (Constant time)

Jelly, 15 bytes

2r⁹*€¹$+Z$FṢQị@

Try it online! (Takes 27.084s for me) (Constant time)

16 bytes, much faster

2r30*€¹$+Z$FṢQị@

Try it online! (Takes 0.947s for me) (Constant time)

Jelly, 14 bytes

2 bytes thanks to Dennis.

R‘*€¹$+Z$FṢQị@

Try it online! (Takes 0m0.950s for me) (Constant time)

Original 16-byte answer

2r30*€¹$+Z$FṢQị@

Try it online! (Takes 0.947s for me) (Constant time)

1
source | link

Jelly, 15 bytes

2r⁹*€¹$+Z$FṢQị@

Try it online! (Takes 27.084s for me) (Constant time)

16 bytes, much faster

2r30*€¹$+Z$FṢQị@

Try it online! (Takes 0.947s for me) (Constant time)