Sha256: 2c272cf232e0747c756e07b2eff9956f6c4037d04548782ee600790c733ce9b1
Contents?: true
Size: 507 Bytes
Versions: 25
Compression:
Stored size: 507 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('Arguments are not same length'); result := 0; for i := Low(strand1) to High(strand1) do result := result + ord(strand1[i] <> strand2[i]); end; end.
Version data entries
25 entries across 25 versions & 1 rubygems