Sha256: 4346f0023c8928a2ea750dbe56e3bbf5008fd8c2034e2105fd90eca1d8fe0d6a

Contents?: true

Size: 302 Bytes

Versions: 69

Compression:

Stored size: 302 Bytes

Contents

class Hamming {
  int compute(String a, String b) {
    if (a.length != b.length) {
      throw new ArgumentError("DNA strands must be of equal length.");
    }

    int diff = 0;

    for (int i = 0; i < a.length; i++) {
      if (a[i] != b[i]) {
        diff++;
      }
    }

    return diff;
  }
}

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.115 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.114 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.113 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.111 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.110 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.109 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.108 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.107 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.106 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.105 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.104 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.103 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.102 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.101 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.100 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.99 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.98 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.97 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.96 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.95 tracks/dart/exercises/hamming/lib/example.dart