trackler 2.0.8.26 → 2.0.8.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/simple-cipher/description.md +4 -2
- data/lib/trackler/version.rb +1 -1
- data/tracks/csharp/appveyor.yml +4 -1
- data/tracks/ecmascript/README.md +1 -1
- data/tracks/haskell/exercises/sieve/src/Sieve.hs +2 -1
- data/tracks/haskell/exercises/simple-cipher/src/Cipher.hs +3 -3
- data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +7 -7
- data/tracks/haskell/exercises/sublist/src/Sublist.hs +1 -1
- data/tracks/haskell/exercises/sum-of-multiples/src/SumOfMultiples.hs +2 -1
- data/tracks/haskell/exercises/triangle/src/Triangle.hs +2 -1
- data/tracks/haskell/exercises/wordy/src/WordProblem.hs +2 -1
- data/tracks/haskell/exercises/zipper/src/Zipper.hs +9 -9
- data/tracks/javascript/config.json +7 -0
- data/tracks/javascript/exercises/perfect-numbers/example.js +67 -0
- data/tracks/javascript/exercises/perfect-numbers/perfect-numbers.spec.js +79 -0
- data/tracks/objective-c/config.json +9 -0
- data/tracks/objective-c/exercises/binary-search/BinarySearchExample.h +11 -0
- data/tracks/objective-c/exercises/binary-search/BinarySearchExample.m +56 -0
- data/tracks/objective-c/exercises/binary-search/BinarySearchTest.m +53 -0
- data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +41 -55
- data/tracks/python/exercises/difference-of-squares/difference_of_squares_test.py +24 -11
- data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +2 -1
- metadata +7 -5
- data/tracks/java/exercises/binary-search/src/main/java/.keep +0 -0
- data/tracks/java/exercises/binary-search-tree/src/test/java/.keep +0 -0
- data/tracks/ocaml/exercises/hello-world/HINTS.md +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c894b894e9f0f3d11e47d960d538044a4863cd
|
4
|
+
data.tar.gz: f0150355935cc408bc6fe6cfb8922fb32bd32267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c70f073bbd990f0d6dbbe5734a19016bc18435f151a009e7c6cd48dda5b2101d5096cc993a749c167a228d97ed29588478d4ace4d0c63ced64976b9234f88b6
|
7
|
+
data.tar.gz: af5c762cba7ea0dc69d25c8e8b05c7108754597a869cf7a5c20ea071a4d6a937c98a5be02d46530a0c8298aba7b7fe59c9ef4a7458e86fa126a949bcb4f6acda
|
@@ -19,7 +19,9 @@ being a couple letters off was sufficient so that people couldn't
|
|
19
19
|
recognize the few words that they did know.
|
20
20
|
|
21
21
|
Your task is to create a simple shift cipher like the Caesar Cipher.
|
22
|
-
This image is a great example of the Caesar Cipher:
|
22
|
+
This image is a great example of the Caesar Cipher:
|
23
|
+
|
24
|
+
![Caesar Cipher][1]
|
23
25
|
|
24
26
|
For example:
|
25
27
|
|
@@ -74,5 +76,5 @@ If you want to go farther in this field, the questions begin to be about
|
|
74
76
|
how we can exchange keys in a secure way. Take a look at [Diffie-Hellman
|
75
77
|
on Wikipedia][dh] for one of the first implementations of this scheme.
|
76
78
|
|
77
|
-
[1]:
|
79
|
+
[1]: https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Caesar_cipher_left_shift_of_3.svg/320px-Caesar_cipher_left_shift_of_3.svg.png
|
78
80
|
[dh]: http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
|
data/lib/trackler/version.rb
CHANGED
data/tracks/csharp/appveyor.yml
CHANGED
data/tracks/ecmascript/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# xECMAScript [![Build Status](https://travis-ci.org/exercism/xecmascript.
|
1
|
+
# xECMAScript [![Build Status](https://travis-ci.org/exercism/xecmascript.svg?branch=master)](https://travis-ci.org/exercism/xecmascript)
|
2
2
|
|
3
3
|
Exercism exercises in ECMAScript 6
|
4
4
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Cipher (caesarDecode, caesarEncode, caesarEncodeRandom) where
|
2
2
|
|
3
3
|
caesarDecode :: String -> String -> String
|
4
|
-
caesarDecode = error "You need to implement this function."
|
4
|
+
caesarDecode key encodedText = error "You need to implement this function."
|
5
5
|
|
6
6
|
caesarEncode :: String -> String -> String
|
7
|
-
caesarEncode = error "You need to implement this function."
|
7
|
+
caesarEncode key text = error "You need to implement this function."
|
8
8
|
|
9
9
|
caesarEncodeRandom :: String -> IO (String, String)
|
10
|
-
caesarEncodeRandom = error "You need to implement this function."
|
10
|
+
caesarEncodeRandom text = error "You need to implement this function."
|
@@ -13,25 +13,25 @@ module LinkedList
|
|
13
13
|
data LinkedList a = Dummy
|
14
14
|
|
15
15
|
datum :: LinkedList a -> a
|
16
|
-
datum = error "You need to implement this function."
|
16
|
+
datum linkedList = error "You need to implement this function."
|
17
17
|
|
18
18
|
fromList :: [a] -> LinkedList a
|
19
|
-
fromList = error "You need to implement this function."
|
19
|
+
fromList xs = error "You need to implement this function."
|
20
20
|
|
21
21
|
isNil :: LinkedList a -> Bool
|
22
|
-
isNil = error "You need to implement this function."
|
22
|
+
isNil linkedList = error "You need to implement this function."
|
23
23
|
|
24
24
|
new :: a -> LinkedList a -> LinkedList a
|
25
|
-
new = error "You need to implement this function."
|
25
|
+
new x linkedList = error "You need to implement this function."
|
26
26
|
|
27
27
|
next :: LinkedList a -> LinkedList a
|
28
|
-
next = error "You need to implement this function."
|
28
|
+
next linkedList = error "You need to implement this function."
|
29
29
|
|
30
30
|
nil :: LinkedList a
|
31
31
|
nil = error "You need to implement this function."
|
32
32
|
|
33
33
|
reverseLinkedList :: LinkedList a -> LinkedList a
|
34
|
-
reverseLinkedList = error "You need to implement this function."
|
34
|
+
reverseLinkedList linkedList = error "You need to implement this function."
|
35
35
|
|
36
36
|
toList :: LinkedList a -> [a]
|
37
|
-
toList = error "You need to implement this function."
|
37
|
+
toList linkedList = error "You need to implement this function."
|
@@ -3,4 +3,4 @@ module Sublist (Sublist(..), sublist) where
|
|
3
3
|
data Sublist = Equal | Sublist | Superlist | Unequal deriving (Eq, Show)
|
4
4
|
|
5
5
|
sublist :: [a] -> [a] -> Sublist
|
6
|
-
sublist = error "You need to implement this function."
|
6
|
+
sublist xs ys = error "You need to implement this function."
|
@@ -19,28 +19,28 @@ data BinTree a = BT { btValue :: a
|
|
19
19
|
data Zipper a = Dummy deriving (Eq, Show)
|
20
20
|
|
21
21
|
fromTree :: BinTree a -> Zipper a
|
22
|
-
fromTree = error "You need to implement this function."
|
22
|
+
fromTree tree = error "You need to implement this function."
|
23
23
|
|
24
24
|
toTree :: Zipper a -> BinTree a
|
25
|
-
toTree = error "You need to implement this function."
|
25
|
+
toTree zipper = error "You need to implement this function."
|
26
26
|
|
27
27
|
value :: Zipper a -> a
|
28
|
-
value = error "You need to implement this function."
|
28
|
+
value zipper = error "You need to implement this function."
|
29
29
|
|
30
30
|
left :: Zipper a -> Maybe (Zipper a)
|
31
|
-
left = error "You need to implement this function."
|
31
|
+
left zipper = error "You need to implement this function."
|
32
32
|
|
33
33
|
right :: Zipper a -> Maybe (Zipper a)
|
34
|
-
right = error "You need to implement this function."
|
34
|
+
right zipper = error "You need to implement this function."
|
35
35
|
|
36
36
|
up :: Zipper a -> Maybe (Zipper a)
|
37
|
-
up = error "You need to implement this function."
|
37
|
+
up zipper = error "You need to implement this function."
|
38
38
|
|
39
39
|
setValue :: a -> Zipper a -> Zipper a
|
40
|
-
setValue = error "You need to implement this function."
|
40
|
+
setValue x zipper = error "You need to implement this function."
|
41
41
|
|
42
42
|
setLeft :: Maybe (BinTree a) -> Zipper a -> Zipper a
|
43
|
-
setLeft = error "You need to implement this function."
|
43
|
+
setLeft tree zipper = error "You need to implement this function."
|
44
44
|
|
45
45
|
setRight :: Maybe (BinTree a) -> Zipper a -> Zipper a
|
46
|
-
setRight = error "You need to implement this function."
|
46
|
+
setRight tree zipper = error "You need to implement this function."
|
@@ -11,6 +11,7 @@
|
|
11
11
|
"rna-transcription",
|
12
12
|
"bob",
|
13
13
|
"gigasecond",
|
14
|
+
"perfect-numbers",
|
14
15
|
"word-count",
|
15
16
|
"isogram",
|
16
17
|
"pangram",
|
@@ -201,6 +202,12 @@
|
|
201
202
|
"difficulty": 1,
|
202
203
|
"topics": [
|
203
204
|
]
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"slug": "perfect-numbers",
|
208
|
+
"difficulty": 1,
|
209
|
+
"topics": [
|
210
|
+
]
|
204
211
|
},
|
205
212
|
{
|
206
213
|
"slug": "word-count",
|
@@ -0,0 +1,67 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var PerfectNumbers = function() {
|
4
|
+
|
5
|
+
};
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Calculate all the divisors for a given number and return them as an array.
|
9
|
+
* Note: the actual number is not include in the returned array.
|
10
|
+
*/
|
11
|
+
PerfectNumbers.prototype.getDivisors = function(number) {
|
12
|
+
|
13
|
+
var i;
|
14
|
+
var divs = new Array();
|
15
|
+
|
16
|
+
// Accepts only natura numbers greater than 1.
|
17
|
+
if (number <= 1) {
|
18
|
+
return divs;
|
19
|
+
}
|
20
|
+
|
21
|
+
// 1 always divides everyone!
|
22
|
+
divs.push(1);
|
23
|
+
|
24
|
+
// Calculate the divisors up the the half of the number + 1
|
25
|
+
for (i = 2; i <= number / 2; i++) {
|
26
|
+
|
27
|
+
if (number % i === 0) {
|
28
|
+
divs.push(i);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
return divs;
|
33
|
+
};
|
34
|
+
|
35
|
+
PerfectNumbers.prototype.classify = function(number) {
|
36
|
+
|
37
|
+
var i, sum, result;
|
38
|
+
|
39
|
+
// Check if the input is valid
|
40
|
+
if (number <= 0) {
|
41
|
+
return 'Classification is only possible for natural numbers.';
|
42
|
+
}
|
43
|
+
|
44
|
+
// Factorize the current number.
|
45
|
+
var divsArray = this.getDivisors(number);
|
46
|
+
|
47
|
+
// Sum the factors.
|
48
|
+
sum = 0;
|
49
|
+
for (i = 0; i < divsArray.length; i++) {
|
50
|
+
sum = sum + divsArray[i];
|
51
|
+
}
|
52
|
+
|
53
|
+
// Check if the number is perfect.
|
54
|
+
if (sum === number) {
|
55
|
+
result = 'perfect';
|
56
|
+
}
|
57
|
+
else if (sum > number) {
|
58
|
+
result = 'abundant';
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
result = 'deficient';
|
62
|
+
}
|
63
|
+
|
64
|
+
return result;
|
65
|
+
};
|
66
|
+
|
67
|
+
module.exports = PerfectNumbers;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
var PerfectNumbers = require('./perfect-numbers');
|
2
|
+
|
3
|
+
describe('Exercise - Perfect Numbers', function() {
|
4
|
+
|
5
|
+
var perfectNumbers;
|
6
|
+
|
7
|
+
beforeEach(function () {
|
8
|
+
perfectNumbers = new PerfectNumbers();
|
9
|
+
});
|
10
|
+
|
11
|
+
describe('Perfect Numbers', function() {
|
12
|
+
|
13
|
+
it('Smallest perfect number is classified correctly', function() {
|
14
|
+
expect(perfectNumbers.classify(6)).toEqual('perfect');
|
15
|
+
});
|
16
|
+
|
17
|
+
it('Medium perfect number is classified correctly', function() {
|
18
|
+
expect(perfectNumbers.classify(28)).toEqual('perfect');
|
19
|
+
});
|
20
|
+
|
21
|
+
it('Large perfect number is classified correctly', function() {
|
22
|
+
expect(perfectNumbers.classify(33550336)).toEqual('perfect');
|
23
|
+
});
|
24
|
+
|
25
|
+
});
|
26
|
+
|
27
|
+
describe('Abundant Numbers', function() {
|
28
|
+
|
29
|
+
it('Smallest abundant number is classified correctly', function() {
|
30
|
+
expect(perfectNumbers.classify(12)).toEqual('abundant');
|
31
|
+
});
|
32
|
+
|
33
|
+
it('Medium abundant number is classified correctly', function() {
|
34
|
+
expect(perfectNumbers.classify(30)).toEqual('abundant');
|
35
|
+
});
|
36
|
+
|
37
|
+
it('Large abundant number is classified correctly', function() {
|
38
|
+
expect(perfectNumbers.classify(33550335)).toEqual('abundant');
|
39
|
+
});
|
40
|
+
|
41
|
+
});
|
42
|
+
|
43
|
+
describe('Deficient Numbers', function() {
|
44
|
+
|
45
|
+
it('Smallest prime deficient number is classified correctly', function() {
|
46
|
+
expect(perfectNumbers.classify(2)).toEqual('deficient');
|
47
|
+
});
|
48
|
+
|
49
|
+
it('Smallest non-prime deficient number is classified correctly', function() {
|
50
|
+
expect(perfectNumbers.classify(4)).toEqual('deficient');
|
51
|
+
});
|
52
|
+
|
53
|
+
it('Medium deficient number is classified correctly', function() {
|
54
|
+
expect(perfectNumbers.classify(32)).toEqual('deficient');
|
55
|
+
});
|
56
|
+
|
57
|
+
it('Large deficient number is classified correctly', function() {
|
58
|
+
expect(perfectNumbers.classify(33550337)).toEqual('deficient');
|
59
|
+
});
|
60
|
+
|
61
|
+
it('Edge case (no factors other than itself) is classified correctly', function() {
|
62
|
+
expect(perfectNumbers.classify(1)).toEqual('deficient');
|
63
|
+
});
|
64
|
+
|
65
|
+
});
|
66
|
+
|
67
|
+
describe('Invalid Inputs', function() {
|
68
|
+
|
69
|
+
it('Zero is rejected (not a natural number)', function() {
|
70
|
+
expect(perfectNumbers.classify(0)).toEqual('Classification is only possible for natural numbers.');
|
71
|
+
});
|
72
|
+
|
73
|
+
it('Negative integer is rejected (not a natural number)', function() {
|
74
|
+
expect(perfectNumbers.classify(-1)).toEqual('Classification is only possible for natural numbers.');
|
75
|
+
});
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
});
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#import "BinarySearchExample.h"
|
2
|
+
|
3
|
+
@implementation BinarySearch
|
4
|
+
|
5
|
+
- (instancetype)initWithArray:(NSArray<NSNumber *> *)array {
|
6
|
+
self = [super init];
|
7
|
+
|
8
|
+
if (self) {
|
9
|
+
// This binary search algorithm only works if the array is already is ascending order.
|
10
|
+
if ([array isEqualToArray:[array sortedArrayUsingSelector:@selector(compare:)]]) {
|
11
|
+
_list = array;
|
12
|
+
} else {
|
13
|
+
return nil;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
return self;
|
18
|
+
}
|
19
|
+
|
20
|
+
- (NSInteger)searchFor:(int)number {
|
21
|
+
NSInteger middleIndex = [self middle];
|
22
|
+
int middle = [self.list[middleIndex] intValue];
|
23
|
+
|
24
|
+
if (middle == number) {
|
25
|
+
return middleIndex;
|
26
|
+
} else if (middle > number) {
|
27
|
+
NSArray *sublist = [self.list subarrayWithRange:NSMakeRange(0, middleIndex)];
|
28
|
+
|
29
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:sublist];
|
30
|
+
if (!binary) {
|
31
|
+
return NSNotFound;
|
32
|
+
}
|
33
|
+
|
34
|
+
return [binary searchFor:number];
|
35
|
+
} else {
|
36
|
+
NSUInteger length = self.list.count - middleIndex;
|
37
|
+
NSArray *sublist = [self.list subarrayWithRange:NSMakeRange(middleIndex, length)];
|
38
|
+
if ([sublist isEqualToArray:self.list]) {
|
39
|
+
return NSNotFound;
|
40
|
+
}
|
41
|
+
|
42
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:sublist];
|
43
|
+
if (!binary) {
|
44
|
+
return NSNotFound;
|
45
|
+
}
|
46
|
+
|
47
|
+
return [binary searchFor:number] + middleIndex;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
- (NSInteger)middle {
|
52
|
+
return self.list.count / 2;
|
53
|
+
}
|
54
|
+
|
55
|
+
@end
|
56
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#import <XCTest/XCTest.h>
|
2
|
+
|
3
|
+
#if __has_include("BinarySearchExample.h")
|
4
|
+
# import "BinarySearchExample.h"
|
5
|
+
# else
|
6
|
+
# import "BinarySearch.h"
|
7
|
+
#endif
|
8
|
+
|
9
|
+
@interface BinarySearchTest : XCTestCase
|
10
|
+
|
11
|
+
@end
|
12
|
+
|
13
|
+
@implementation BinarySearchTest
|
14
|
+
|
15
|
+
- (void)testHasListData {
|
16
|
+
NSArray *array = @[@1, @3, @4, @6, @8, @9, @11];
|
17
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:array];
|
18
|
+
XCTAssertEqualObjects(binary.list, array);
|
19
|
+
}
|
20
|
+
|
21
|
+
- (void)testNilForUnsortedList {
|
22
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:@[@2, @1, @4, @3, @6]];
|
23
|
+
XCTAssertNil(binary);
|
24
|
+
}
|
25
|
+
|
26
|
+
- (void)testNotFoundForDataNotInList {
|
27
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:@[@1, @3, @6]];
|
28
|
+
XCTAssertEqual([binary searchFor:2], NSNotFound);
|
29
|
+
}
|
30
|
+
|
31
|
+
- (void)testFindsPositionOfMiddleItem {
|
32
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:@[@1, @3, @4, @6, @8, @9, @11]];
|
33
|
+
XCTAssertEqual(3, [binary middle]);
|
34
|
+
}
|
35
|
+
|
36
|
+
- (void)testFindsPositionOfSearchData {
|
37
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:@[@1, @3, @4, @6, @8, @9, @11]];
|
38
|
+
XCTAssertEqual(5, [binary searchFor:9]);
|
39
|
+
}
|
40
|
+
|
41
|
+
- (void)testFindsPositionInALargerList {
|
42
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:@[@1, @3, @5, @8, @13, @21, @34, @55, @89, @144]];
|
43
|
+
XCTAssertEqual(1, [binary searchFor:3]);
|
44
|
+
XCTAssertEqual(7, [binary searchFor:55]);
|
45
|
+
}
|
46
|
+
|
47
|
+
- (void)testFindsCorrectPositionInAListWithAnEvenNumberOfElements {
|
48
|
+
BinarySearch *binary = [[BinarySearch alloc] initWithArray:@[@1, @3, @5, @8, @13, @21, @34, @55, @89, @144, @233, @377]];
|
49
|
+
XCTAssertEqual(5, [binary searchFor:21]);
|
50
|
+
XCTAssertEqual(6, [binary searchFor:34]);
|
51
|
+
}
|
52
|
+
|
53
|
+
@end
|
@@ -47,23 +47,15 @@
|
|
47
47
|
1EFACABA1CCCAF3D006F2E69 /* SpaceAgeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EFACA9F1CCCAF3D006F2E69 /* SpaceAgeTest.m */; };
|
48
48
|
1EFACABB1CCCAF3D006F2E69 /* WordCountExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EFACAA11CCCAF3D006F2E69 /* WordCountExample.m */; };
|
49
49
|
1EFACABC1CCCAF3D006F2E69 /* WordCountTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EFACAA21CCCAF3D006F2E69 /* WordCountTest.m */; };
|
50
|
-
|
50
|
+
A065F5781E3098080048E337 /* BeerSongExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A065F5761E3098080048E337 /* BeerSongExample.m */; };
|
51
|
+
A065F5791E3098080048E337 /* BeerSongTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A065F5771E3098080048E337 /* BeerSongTest.m */; };
|
52
|
+
A097D40F1E363C2700EAF2C2 /* BracketPushExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A097D40D1E363C2700EAF2C2 /* BracketPushExample.m */; };
|
53
|
+
A097D4101E363C2700EAF2C2 /* BracketPushTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A097D40E1E363C2700EAF2C2 /* BracketPushTest.m */; };
|
51
54
|
A09A4C031E38761A00FEFB7A /* FlattenArrayExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A09A4C021E38761A00FEFB7A /* FlattenArrayExample.m */; };
|
52
55
|
A09A4C051E38763300FEFB7A /* FlattenArrayTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A09A4C041E38763300FEFB7A /* FlattenArrayTest.m */; };
|
53
|
-
E907D0CA1D6B731600106C42 /* GigasecondExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E907D0C91D6B731600106C42 /* GigasecondExample.m */; };
|
54
|
-
|
55
|
-
|
56
56
|
A0BBFCBF1E37719800230071 /* SublistExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A0BBFCBE1E37719800230071 /* SublistExample.m */; };
|
57
57
|
A0BBFCC31E37728100230071 /* SublistTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A0BBFCC21E37728100230071 /* SublistTest.m */; };
|
58
|
-
|
59
|
-
|
60
|
-
A097D40F1E363C2700EAF2C2 /* BracketPushExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A097D40D1E363C2700EAF2C2 /* BracketPushExample.m */; };
|
61
|
-
A097D4101E363C2700EAF2C2 /* BracketPushTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A097D40E1E363C2700EAF2C2 /* BracketPushTest.m */; };
|
62
|
-
|
63
|
-
A065F5781E3098080048E337 /* BeerSongExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A065F5761E3098080048E337 /* BeerSongExample.m */; };
|
64
|
-
A065F5791E3098080048E337 /* BeerSongTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A065F5771E3098080048E337 /* BeerSongTest.m */; };
|
65
|
-
|
66
|
-
E907D0CA1D6B731600106C42 /* GigasecondExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E907D0C91D6B731600106C42 /* GigasecondExample.m */; };
|
58
|
+
E907D0CA1D6B731600106C42 /* GigasecondExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E907D0C91D6B731600106C42 /* GigasecondExample.m */; };
|
67
59
|
E907D0CC1D6B734800106C42 /* GigasecondTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E907D0CB1D6B734800106C42 /* GigasecondTest.m */; };
|
68
60
|
E907FE921D87547D00B93DA9 /* ScrabbleScoreExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E907FE911D87547D00B93DA9 /* ScrabbleScoreExample.m */; };
|
69
61
|
E907FE941D87554500B93DA9 /* ScrabbleScoreTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E907FE931D87554500B93DA9 /* ScrabbleScoreTest.m */; };
|
@@ -83,6 +75,8 @@
|
|
83
75
|
E94ACA151D41763800D56CC2 /* AllYourBaseTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E94ACA141D41763800D56CC2 /* AllYourBaseTest.m */; };
|
84
76
|
E951B6B71D4294E6009EB5B6 /* AllergiesExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E951B6B61D4294E6009EB5B6 /* AllergiesExample.m */; };
|
85
77
|
E951B6B91D429550009EB5B6 /* AllergiesTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E951B6B81D429550009EB5B6 /* AllergiesTest.m */; };
|
78
|
+
E95C52551E81C82A0095D321 /* BinarySearchExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E95C52531E81C82A0095D321 /* BinarySearchExample.m */; };
|
79
|
+
E95C52561E81C82A0095D321 /* BinarySearchTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E95C52541E81C82A0095D321 /* BinarySearchTest.m */; };
|
86
80
|
E96993981DF60E1E009EA223 /* TransposeExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E96993971DF60E1E009EA223 /* TransposeExample.m */; };
|
87
81
|
E969939A1DF60E5F009EA223 /* TransposeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E96993991DF60E5F009EA223 /* TransposeTest.m */; };
|
88
82
|
E99D1D811D5533BF0006A303 /* SumOfMultiplesExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E99D1D801D5533BF0006A303 /* SumOfMultiplesExample.m */; };
|
@@ -145,27 +139,18 @@
|
|
145
139
|
1EFACAA01CCCAF3D006F2E69 /* WordCountExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordCountExample.h; path = "../../exercises/word-count/WordCountExample.h"; sourceTree = "<group>"; };
|
146
140
|
1EFACAA11CCCAF3D006F2E69 /* WordCountExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WordCountExample.m; path = "../../exercises/word-count/WordCountExample.m"; sourceTree = "<group>"; };
|
147
141
|
1EFACAA21CCCAF3D006F2E69 /* WordCountTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WordCountTest.m; path = "../../exercises/word-count/WordCountTest.m"; sourceTree = "<group>"; };
|
148
|
-
|
142
|
+
A065F5751E3098080048E337 /* BeerSongExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BeerSongExample.h; path = "../../exercises/beer-song/BeerSongExample.h"; sourceTree = "<group>"; };
|
143
|
+
A065F5761E3098080048E337 /* BeerSongExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BeerSongExample.m; path = "../../exercises/beer-song/BeerSongExample.m"; sourceTree = "<group>"; };
|
144
|
+
A065F5771E3098080048E337 /* BeerSongTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BeerSongTest.m; path = "../../exercises/beer-song/BeerSongTest.m"; sourceTree = "<group>"; };
|
145
|
+
A097D40C1E363C1A00EAF2C2 /* BracketPushExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BracketPushExample.h; path = "../../exercises/bracket-push/BracketPushExample.h"; sourceTree = "<group>"; };
|
146
|
+
A097D40D1E363C2700EAF2C2 /* BracketPushExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BracketPushExample.m; path = "../../exercises/bracket-push/BracketPushExample.m"; sourceTree = "<group>"; };
|
147
|
+
A097D40E1E363C2700EAF2C2 /* BracketPushTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BracketPushTest.m; path = "../../exercises/bracket-push/BracketPushTest.m"; sourceTree = "<group>"; };
|
149
148
|
A09A4C011E38761A00FEFB7A /* FlattenArrayExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlattenArrayExample.h; path = "../../exercises/flatten-array/FlattenArrayExample.h"; sourceTree = "<group>"; };
|
150
149
|
A09A4C021E38761A00FEFB7A /* FlattenArrayExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlattenArrayExample.m; path = "../../exercises/flatten-array/FlattenArrayExample.m"; sourceTree = "<group>"; };
|
151
150
|
A09A4C041E38763300FEFB7A /* FlattenArrayTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlattenArrayTest.m; path = "../../exercises/flatten-array/FlattenArrayTest.m"; sourceTree = "<group>"; };
|
152
|
-
|
153
|
-
|
154
|
-
A0BBFCBD1E37719800230071 /* SublistExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SublistExample.h; path = ../../exercises/sublist/SublistExample.h; sourceTree = "<group>"; };
|
151
|
+
A0BBFCBD1E37719800230071 /* SublistExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SublistExample.h; path = ../../exercises/sublist/SublistExample.h; sourceTree = "<group>"; };
|
155
152
|
A0BBFCBE1E37719800230071 /* SublistExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SublistExample.m; path = ../../exercises/sublist/SublistExample.m; sourceTree = "<group>"; };
|
156
153
|
A0BBFCC21E37728100230071 /* SublistTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SublistTest.m; path = ../../exercises/sublist/SublistTest.m; sourceTree = "<group>"; };
|
157
|
-
|
158
|
-
|
159
|
-
A097D40C1E363C1A00EAF2C2 /* BracketPushExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BracketPushExample.h; path = "../../exercises/bracket-push/BracketPushExample.h"; sourceTree = "<group>"; };
|
160
|
-
A097D40D1E363C2700EAF2C2 /* BracketPushExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BracketPushExample.m; path = "../../exercises/bracket-push/BracketPushExample.m"; sourceTree = "<group>"; };
|
161
|
-
A097D40E1E363C2700EAF2C2 /* BracketPushTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BracketPushTest.m; path = "../../exercises/bracket-push/BracketPushTest.m"; sourceTree = "<group>"; };
|
162
|
-
|
163
|
-
A065F5751E3098080048E337 /* BeerSongExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BeerSongExample.h; path = "../../exercises/beer-song/BeerSongExample.h"; sourceTree = "<group>"; };
|
164
|
-
A065F5761E3098080048E337 /* BeerSongExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BeerSongExample.m; path = "../../exercises/beer-song/BeerSongExample.m"; sourceTree = "<group>"; };
|
165
|
-
A065F5771E3098080048E337 /* BeerSongTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BeerSongTest.m; path = "../../exercises/beer-song/BeerSongTest.m"; sourceTree = "<group>"; };
|
166
|
-
|
167
|
-
|
168
|
-
|
169
154
|
E907D0C81D6B731600106C42 /* GigasecondExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GigasecondExample.h; path = ../../exercises/gigasecond/GigasecondExample.h; sourceTree = "<group>"; };
|
170
155
|
E907D0C91D6B731600106C42 /* GigasecondExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GigasecondExample.m; path = ../../exercises/gigasecond/GigasecondExample.m; sourceTree = "<group>"; };
|
171
156
|
E907D0CB1D6B734800106C42 /* GigasecondTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GigasecondTest.m; path = ../../exercises/gigasecond/GigasecondTest.m; sourceTree = "<group>"; };
|
@@ -196,6 +181,9 @@
|
|
196
181
|
E951B6B51D4294E6009EB5B6 /* AllergiesExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AllergiesExample.h; path = ../../exercises/allergies/AllergiesExample.h; sourceTree = "<group>"; };
|
197
182
|
E951B6B61D4294E6009EB5B6 /* AllergiesExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AllergiesExample.m; path = ../../exercises/allergies/AllergiesExample.m; sourceTree = "<group>"; };
|
198
183
|
E951B6B81D429550009EB5B6 /* AllergiesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AllergiesTest.m; path = ../../exercises/allergies/AllergiesTest.m; sourceTree = "<group>"; };
|
184
|
+
E95C52521E81C82A0095D321 /* BinarySearchExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinarySearchExample.h; path = "../../exercises/binary-search/BinarySearchExample.h"; sourceTree = "<group>"; };
|
185
|
+
E95C52531E81C82A0095D321 /* BinarySearchExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BinarySearchExample.m; path = "../../exercises/binary-search/BinarySearchExample.m"; sourceTree = "<group>"; };
|
186
|
+
E95C52541E81C82A0095D321 /* BinarySearchTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BinarySearchTest.m; path = "../../exercises/binary-search/BinarySearchTest.m"; sourceTree = "<group>"; };
|
199
187
|
E96993961DF60E1E009EA223 /* TransposeExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransposeExample.h; path = ../../exercises/transpose/TransposeExample.h; sourceTree = "<group>"; };
|
200
188
|
E96993971DF60E1E009EA223 /* TransposeExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TransposeExample.m; path = ../../exercises/transpose/TransposeExample.m; sourceTree = "<group>"; };
|
201
189
|
E96993991DF60E5F009EA223 /* TransposeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TransposeTest.m; path = ../../exercises/transpose/TransposeTest.m; sourceTree = "<group>"; };
|
@@ -245,6 +233,7 @@
|
|
245
233
|
E9E8B6EB1D519DE70012F12C /* Anagram */,
|
246
234
|
E9386EEB1E0B68F90009A414 /* AtbashCipher */,
|
247
235
|
A0CE03811E2F994200669F42 /* BeerSong */,
|
236
|
+
E95C52481E806BA20095D321 /* BinarySearch */,
|
248
237
|
E9E8B6EC1D519DEF0012F12C /* Bob */,
|
249
238
|
A09A906D1E28C1380087CCB7 /* BracketPush */,
|
250
239
|
E9381D4F1D8F2DA4003F22A1 /* Clock */,
|
@@ -296,7 +285,6 @@
|
|
296
285
|
name = Products;
|
297
286
|
sourceTree = "<group>";
|
298
287
|
};
|
299
|
-
|
300
288
|
A09A4C001E3875C200FEFB7A /* FlattenArray */ = {
|
301
289
|
isa = PBXGroup;
|
302
290
|
children = (
|
@@ -307,8 +295,16 @@
|
|
307
295
|
name = FlattenArray;
|
308
296
|
sourceTree = "<group>";
|
309
297
|
};
|
310
|
-
|
311
|
-
|
298
|
+
A09A906D1E28C1380087CCB7 /* BracketPush */ = {
|
299
|
+
isa = PBXGroup;
|
300
|
+
children = (
|
301
|
+
A097D40C1E363C1A00EAF2C2 /* BracketPushExample.h */,
|
302
|
+
A097D40D1E363C2700EAF2C2 /* BracketPushExample.m */,
|
303
|
+
A097D40E1E363C2700EAF2C2 /* BracketPushTest.m */,
|
304
|
+
);
|
305
|
+
name = BracketPush;
|
306
|
+
sourceTree = "<group>";
|
307
|
+
};
|
312
308
|
A0BBFCBC1E37703D00230071 /* Sublist */ = {
|
313
309
|
isa = PBXGroup;
|
314
310
|
children = (
|
@@ -319,19 +315,6 @@
|
|
319
315
|
name = Sublist;
|
320
316
|
sourceTree = "<group>";
|
321
317
|
};
|
322
|
-
|
323
|
-
|
324
|
-
A09A906D1E28C1380087CCB7 /* BracketPush */ = {
|
325
|
-
isa = PBXGroup;
|
326
|
-
children = (
|
327
|
-
A097D40C1E363C1A00EAF2C2 /* BracketPushExample.h */,
|
328
|
-
A097D40D1E363C2700EAF2C2 /* BracketPushExample.m */,
|
329
|
-
A097D40E1E363C2700EAF2C2 /* BracketPushTest.m */,
|
330
|
-
);
|
331
|
-
name = BracketPush;
|
332
|
-
sourceTree = "<group>";
|
333
|
-
};
|
334
|
-
|
335
318
|
A0CE03811E2F994200669F42 /* BeerSong */ = {
|
336
319
|
isa = PBXGroup;
|
337
320
|
children = (
|
@@ -340,11 +323,8 @@
|
|
340
323
|
A065F5771E3098080048E337 /* BeerSongTest.m */,
|
341
324
|
);
|
342
325
|
name = BeerSong;
|
343
|
-
|
326
|
+
sourceTree = "<group>";
|
344
327
|
};
|
345
|
-
|
346
|
-
|
347
|
-
|
348
328
|
E907D0C71D6B72B600106C42 /* Gigasecond */ = {
|
349
329
|
isa = PBXGroup;
|
350
330
|
children = (
|
@@ -425,6 +405,16 @@
|
|
425
405
|
name = Triangle;
|
426
406
|
sourceTree = "<group>";
|
427
407
|
};
|
408
|
+
E95C52481E806BA20095D321 /* BinarySearch */ = {
|
409
|
+
isa = PBXGroup;
|
410
|
+
children = (
|
411
|
+
E95C52521E81C82A0095D321 /* BinarySearchExample.h */,
|
412
|
+
E95C52531E81C82A0095D321 /* BinarySearchExample.m */,
|
413
|
+
E95C52541E81C82A0095D321 /* BinarySearchTest.m */,
|
414
|
+
);
|
415
|
+
name = BinarySearch;
|
416
|
+
sourceTree = "<group>";
|
417
|
+
};
|
428
418
|
E96993951DF60DF1009EA223 /* Transpose */ = {
|
429
419
|
isa = PBXGroup;
|
430
420
|
children = (
|
@@ -759,11 +749,9 @@
|
|
759
749
|
E9C1C0291D9DB16B0015E86E /* AcronymExample.m in Sources */,
|
760
750
|
1EFACAA41CCCAF3D006F2E69 /* AnagramTest.m in Sources */,
|
761
751
|
E907FE921D87547D00B93DA9 /* ScrabbleScoreExample.m in Sources */,
|
762
|
-
|
763
752
|
A09A4C051E38763300FEFB7A /* FlattenArrayTest.m in Sources */,
|
764
|
-
|
765
753
|
A097D4101E363C2700EAF2C2 /* BracketPushTest.m in Sources */,
|
766
|
-
|
754
|
+
E95C52551E81C82A0095D321 /* BinarySearchExample.m in Sources */,
|
767
755
|
1EFACABC1CCCAF3D006F2E69 /* WordCountTest.m in Sources */,
|
768
756
|
1EFACAB11CCCAF3D006F2E69 /* NucleotideCountExample.m in Sources */,
|
769
757
|
E9381D481D8EE00C003F22A1 /* DifferenceOfSquaresTest.m in Sources */,
|
@@ -779,11 +767,8 @@
|
|
779
767
|
E9381D521D8F2DCC003F22A1 /* ClockExample.m in Sources */,
|
780
768
|
E99D1D811D5533BF0006A303 /* SumOfMultiplesExample.m in Sources */,
|
781
769
|
E9F390071DFCA337005C5F46 /* IsogramExample.m in Sources */,
|
782
|
-
|
783
770
|
A09A4C031E38761A00FEFB7A /* FlattenArrayExample.m in Sources */,
|
784
|
-
|
785
771
|
A0BBFCC31E37728100230071 /* SublistTest.m in Sources */,
|
786
|
-
|
787
772
|
E9C1C02F1D9EC1130015E86E /* RunLengthEncodingExample.m in Sources */,
|
788
773
|
E92FCC0F1D78F3B600061017 /* MeetupTest.m in Sources */,
|
789
774
|
E9381D4E1D8F2982003F22A1 /* RaindropsTest.m in Sources */,
|
@@ -828,6 +813,7 @@
|
|
828
813
|
E9C1C0251D9D99620015E86E /* SecretHandshakeTest.m in Sources */,
|
829
814
|
E969939A1DF60E5F009EA223 /* TransposeTest.m in Sources */,
|
830
815
|
E99D1D831D5533D80006A303 /* SumOfMultiplesTest.m in Sources */,
|
816
|
+
E95C52561E81C82A0095D321 /* BinarySearchTest.m in Sources */,
|
831
817
|
1EFACAAA1CCCAF3D006F2E69 /* GradeSchoolTest.m in Sources */,
|
832
818
|
);
|
833
819
|
runOnlyForDeploymentPostprocessing = 0;
|
@@ -3,25 +3,38 @@ import unittest
|
|
3
3
|
from difference_of_squares import difference, square_of_sum, sum_of_squares
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
7
7
|
|
8
|
+
class DifferenceOfSquaresTest(unittest.TestCase):
|
8
9
|
def test_square_of_sum_5(self):
|
9
|
-
self.assertEqual(
|
10
|
+
self.assertEqual(square_of_sum(5), 225)
|
10
11
|
|
11
|
-
def
|
12
|
-
self.assertEqual(
|
13
|
-
|
14
|
-
def test_difference_5(self):
|
15
|
-
self.assertEqual(170, difference(5))
|
12
|
+
def test_square_of_sum_10(self):
|
13
|
+
self.assertEqual(square_of_sum(10), 3025)
|
16
14
|
|
17
15
|
def test_square_of_sum_100(self):
|
18
|
-
self.assertEqual(
|
16
|
+
self.assertEqual(square_of_sum(100), 25502500)
|
17
|
+
|
18
|
+
def test_sum_of_squares_5(self):
|
19
|
+
self.assertEqual(sum_of_squares(5), 55)
|
20
|
+
|
21
|
+
def test_sum_of_squares_10(self):
|
22
|
+
self.assertEqual(sum_of_squares(10), 385)
|
19
23
|
|
20
24
|
def test_sum_of_squares_100(self):
|
21
|
-
self.assertEqual(
|
25
|
+
self.assertEqual(sum_of_squares(100), 338350)
|
26
|
+
|
27
|
+
def test_difference_of_squares_0(self):
|
28
|
+
self.assertEqual(difference(0), 0)
|
29
|
+
|
30
|
+
def test_difference_of_squares_5(self):
|
31
|
+
self.assertEqual(difference(5), 170)
|
32
|
+
|
33
|
+
def test_difference_of_squares_10(self):
|
34
|
+
self.assertEqual(difference(10), 2640)
|
22
35
|
|
23
|
-
def
|
24
|
-
self.assertEqual(
|
36
|
+
def test_difference_of_squares_100(self):
|
37
|
+
self.assertEqual(difference(100), 25164150)
|
25
38
|
|
26
39
|
|
27
40
|
if __name__ == '__main__':
|
@@ -3,8 +3,9 @@ import unittest
|
|
3
3
|
from rna_transcription import to_rna
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
7
7
|
|
8
|
+
class DNATests(unittest.TestCase):
|
8
9
|
def test_transcribes_guanine_to_cytosine(self):
|
9
10
|
self.assertEqual('C', to_rna('G'))
|
10
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.8.
|
4
|
+
version: 2.0.8.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -4223,11 +4223,9 @@ files:
|
|
4223
4223
|
- tracks/java/exercises/binary-search-tree/build.gradle
|
4224
4224
|
- tracks/java/exercises/binary-search-tree/src/example/java/BST.java
|
4225
4225
|
- tracks/java/exercises/binary-search-tree/src/main/java/.keep
|
4226
|
-
- tracks/java/exercises/binary-search-tree/src/test/java/.keep
|
4227
4226
|
- tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java
|
4228
4227
|
- tracks/java/exercises/binary-search/build.gradle
|
4229
4228
|
- tracks/java/exercises/binary-search/src/example/java/BinarySearch.java
|
4230
|
-
- tracks/java/exercises/binary-search/src/main/java/.keep
|
4231
4229
|
- tracks/java/exercises/binary-search/src/main/java/BinarySearch.java
|
4232
4230
|
- tracks/java/exercises/binary-search/src/test/java/.keep
|
4233
4231
|
- tracks/java/exercises/binary-search/src/test/java/BinarySearchTest.java
|
@@ -4609,6 +4607,8 @@ files:
|
|
4609
4607
|
- tracks/javascript/exercises/pangram/pangram.spec.js
|
4610
4608
|
- tracks/javascript/exercises/pascals-triangle/example.js
|
4611
4609
|
- tracks/javascript/exercises/pascals-triangle/pascals-triangle.spec.js
|
4610
|
+
- tracks/javascript/exercises/perfect-numbers/example.js
|
4611
|
+
- tracks/javascript/exercises/perfect-numbers/perfect-numbers.spec.js
|
4612
4612
|
- tracks/javascript/exercises/phone-number/example.js
|
4613
4613
|
- tracks/javascript/exercises/phone-number/phone-number.spec.js
|
4614
4614
|
- tracks/javascript/exercises/pig-latin/example.js
|
@@ -5593,6 +5593,9 @@ files:
|
|
5593
5593
|
- tracks/objective-c/exercises/beer-song/BeerSongExample.h
|
5594
5594
|
- tracks/objective-c/exercises/beer-song/BeerSongExample.m
|
5595
5595
|
- tracks/objective-c/exercises/beer-song/BeerSongTest.m
|
5596
|
+
- tracks/objective-c/exercises/binary-search/BinarySearchExample.h
|
5597
|
+
- tracks/objective-c/exercises/binary-search/BinarySearchExample.m
|
5598
|
+
- tracks/objective-c/exercises/binary-search/BinarySearchTest.m
|
5596
5599
|
- tracks/objective-c/exercises/bob/BobExample.h
|
5597
5600
|
- tracks/objective-c/exercises/bob/BobExample.m
|
5598
5601
|
- tracks/objective-c/exercises/bob/BobTest.m
|
@@ -5786,7 +5789,6 @@ files:
|
|
5786
5789
|
- tracks/ocaml/exercises/hangman/hangman.mli
|
5787
5790
|
- tracks/ocaml/exercises/hangman/test.ml
|
5788
5791
|
- tracks/ocaml/exercises/hello-world/.merlin
|
5789
|
-
- tracks/ocaml/exercises/hello-world/HINTS.md
|
5790
5792
|
- tracks/ocaml/exercises/hello-world/Makefile
|
5791
5793
|
- tracks/ocaml/exercises/hello-world/example.ml
|
5792
5794
|
- tracks/ocaml/exercises/hello-world/hello_world.ml
|
File without changes
|
File without changes
|
@@ -1,31 +0,0 @@
|
|
1
|
-
## Use of `option`
|
2
|
-
The type signature of the `greet` function reads `string option -> string`. It
|
3
|
-
could be that this is your first time to encounter an Option type.
|
4
|
-
|
5
|
-
An option type is an explicit way to signal that a value could be missing for a
|
6
|
-
legitimate reason.
|
7
|
-
|
8
|
-
In OCaml Options types are implemented as
|
9
|
-
a [variant type](https://realworldocaml.org/v1/en/html/variants.html) something
|
10
|
-
like
|
11
|
-
|
12
|
-
```ocaml
|
13
|
-
type 'a option =
|
14
|
-
| None
|
15
|
-
| Some of 'a
|
16
|
-
```
|
17
|
-
|
18
|
-
In the case of `string option` you provide an argument using one of the
|
19
|
-
following snippets
|
20
|
-
|
21
|
-
1. `None` to signal that no subject is passed.
|
22
|
-
2. `Some("Alice")` to provide an actual subject.
|
23
|
-
|
24
|
-
Just like other variants types you can match on an option. The example below
|
25
|
-
demonstrates how this can be done. Here `x` is an `string option`.
|
26
|
-
|
27
|
-
```ocaml
|
28
|
-
match x with
|
29
|
-
| None -> "no argument passed"
|
30
|
-
| Some(argument) -> "argument passed"
|
31
|
-
```
|