Sha256: bfb721632fc23863f6f1abde51ee9a21af2da3728af3e03fa29e13eee7ad85a6
Contents?: true
Size: 531 Bytes
Versions: 168
Compression:
Stored size: 531 Bytes
Contents
unit uHamming; interface type THamming = class public class function Distance(strand1, strand2: string): integer; static; end; implementation uses System.SysUtils; class function THamming.Distance(strand1, strand2: string): integer; var i: integer; begin if strand1.Length <> strand2.Length then raise EArgumentException.Create('error: left and right strands must be of equal length'); result := 0; for i := Low(strand1) to High(strand1) do result := result + ord(strand1[i] <> strand2[i]); end; end.
Version data entries
168 entries across 168 versions & 1 rubygems