Post History
Perl, 80 bytes Naïve implementation of the suggested algorithm. sub g{pop until@_<3||$_[-3]+$_[-2]-$_[-1];shift until@_<3||$_[0]+$_[1]-$_[2];@_} Try it online!
#1: Initial revision
# [Perl], 80 bytes
Naïve implementation of the suggested algorithm.
<!-- language-all: lang-perl -->
sub g{pop until@_<3||$_[-3]+$_[-2]-$_[-1];shift until@_<3||$_[0]+$_[1]-$_[2];@_}
[Try it online!][TIO-mspn94b4]
[Perl]: https://www.perl.org/
[TIO-mspn94b4]: https://tio.run/##bZDdasMwDIXv8xSiK/Rix@CfuInxNvoexYQO0h8oW2iSi7Hu2TM5IWua1WBJoO/oyK7Ky9l2bV3Svtw17aWkVb37WvlkidcFFr6r23c6fFefFbUfzem8KV7M9bostsKE55h0EDGp4Ovjad/MKNlDqmd08Jvip@PxdCANBcM3hYWDSunueHoi8UbbngnJIFEZhDKsEA5rCMM9iRjXcDfJ0P7T9DYpMiguc2iHNENm5zaPqXGKiIBEjLfywbJDOyQTc82DLXLw4ppN@Ll2JuPuxIcx5nkR/iAHo2AlcnUnYGQUTOf9P6NAxp26Xw "Perl 5 – Try It Online"
