We want to find out the first position $n at which strings $x and $y differ. If $x eq $y, then $n is undef. If $x ne $y but $x is a prefix (aka initial segment) of $y, then $n should be equal to length $x. The operation must preserve both $x and $y (i.e. destructive operations are disallowed). By way of baseline, here's an utterly uninspired solution: $n=0;while(($c=substr($x,$n,1)||undef $n) && $c eq substr($y,$n++,1)){;} kj
- Re: mini-golf: first differing position kynn
- Re: mini-golf: first differing position kynn
- RE: mini-golf: first differing position Terje Kristensen
- Re: mini-golf: first differing position Bernie Cosell
- Re: mini-golf: first differing position Craig S. Cottingham
- Re: mini-golf: first differing positi... Bernie Cosell
- Re: mini-golf: first differing po... Yitzchak Scott-Thoennes
- Re: mini-golf: first differing position Xavier Noria
- Re: mini-golf: first differing position Xavier Noria
- Re: mini-golf: first differing position Xavier Noria