5 ms·
a) why not use switch { case len(a) < len(b): b = b[:len(a)] case len(b) < len(a): a = a[:len(b)] } b) do you know the usual length of the slices?
by hknmtt 3y ago
a) why not use
switch {
case len(a) < len(b):
b = b[:len(a)]
case len(b) < len(a):
a = a[:len(b)]
}
b) do you know the usual length of the slices? if so, can't you autogenerate/manually write switch to manually do the math? how would that perform?