Sha256: b1a927b4ebee4df1ca845984790f341bc4a02155a79cbb98f4a9b94f5d9b25f3

Contents?: true

Size: 303 Bytes

Versions: 64

Compression:

Stored size: 303 Bytes

Contents

class Hamming {
  int distance(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

64 entries across 64 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.179 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.178 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.177 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.176 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.175 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.174 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.173 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.172 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.171 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.170 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.169 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.167 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.166 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.165 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.164 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.163 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.162 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.161 tracks/dart/exercises/hamming/lib/example.dart
trackler-2.2.1.160 tracks/dart/exercises/hamming/lib/example.dart