How to improve Ruby code under some restrictions
105

You can save three bytes by declaring n as a local variable (instead of a global) before f:



n=?~.ord
f=-&gt;a{b,c,d=a;b ?a==b ?~-a:a==a-[c-c]?[[b,c,f[d]],~-c,b]:b:n}
h=[],n,[]
h=f[h]until h==p(n+=n)-n