Skip to main content
11 events
when toggle format what by license comment
Mar 9, 2021 at 10:13 comment added Arnauld @tsh eval() is so bad that I'm reluctant to use it even in golfed code. :-p But it's OK here since this code is fast by definition. Thank you!
Mar 9, 2021 at 10:11 history edited Arnauld CC BY-SA 4.0
saved 2 bytes
Mar 9, 2021 at 9:29 comment added tsh Whenever you write return, you may change it to eval: n=>C=a=>eval('for(i=j=a.length,c=s=0;~j;c+=c<n?(C[v=a[--j]]=-~C[v])<2:-!--C[s-=~j,a[--i]])s')
Mar 9, 2021 at 8:35 comment added Arnauld @user81655 Thank you! I golfed a few more bytes by starting from the end of the sequence and getting rid of L.
Mar 9, 2021 at 8:34 history edited Arnauld CC BY-SA 4.0
saved 6 bytes
Mar 9, 2021 at 8:15 history edited Arnauld CC BY-SA 4.0
saved 18 bytes
Mar 9, 2021 at 2:49 comment added user81655 Alternatively 101 bytes where it doesn't fail for large inputs due to recursion limit in above solution
Mar 9, 2021 at 2:46 comment added user81655 93 bytes
Mar 9, 2021 at 1:16 history edited Arnauld CC BY-SA 4.0
saved 7 bytes
Mar 9, 2021 at 1:02 history edited Arnauld CC BY-SA 4.0
saved 10 bytes
Mar 9, 2021 at 0:53 history answered Arnauld CC BY-SA 4.0