trackler 2.2.1.46 → 2.2.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/nucleotide-count/canonical-data.json +7 -7
- data/tracks/c/README.md +1 -1
- data/tracks/c/docs/SNIPPET.txt +2 -3
- data/tracks/c/exercises/acronym/test/test_acronym.c +8 -0
- data/tracks/c/exercises/all-your-base/test/test_all_your_base.c +8 -0
- data/tracks/c/exercises/allergies/test/test_allergies.c +8 -0
- data/tracks/c/exercises/anagram/test/test_anagram.c +8 -0
- data/tracks/c/exercises/atbash-cipher/test/test_atbash_cipher.c +8 -0
- data/tracks/c/exercises/beer-song/src/example.c +23 -22
- data/tracks/c/exercises/beer-song/src/example.h +3 -3
- data/tracks/c/exercises/beer-song/test/test_beer_song.c +8 -0
- data/tracks/c/exercises/binary-search/test/test_binary_search.c +8 -0
- data/tracks/c/exercises/binary/test/test_binary.c +8 -0
- data/tracks/c/exercises/bob/test/test_bob.c +8 -0
- data/tracks/c/exercises/clock/test/test_clock.c +8 -0
- data/tracks/c/exercises/difference-of-squares/test/test_difference_of_squares.c +8 -0
- data/tracks/c/exercises/gigasecond/test/test_gigasecond.c +8 -0
- data/tracks/c/exercises/grains/test/test_grains.c +8 -0
- data/tracks/c/exercises/hamming/test/test_hamming.c +8 -0
- data/tracks/c/exercises/hello-world/src/example.c +0 -2
- data/tracks/c/exercises/hello-world/test/test_hello_world.c +8 -0
- data/tracks/c/exercises/isogram/test/test_isogram.c +8 -0
- data/tracks/c/exercises/largest-series-product/test/test_largest_series_product.c +8 -0
- data/tracks/c/exercises/leap/test/test_leap.c +8 -0
- data/tracks/c/exercises/meetup/test/test_meetup.c +8 -0
- data/tracks/c/exercises/nth-prime/test/test_nth_prime.c +8 -0
- data/tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c +8 -0
- data/tracks/c/exercises/palindrome-products/test/test_palindrome_products.c +8 -0
- data/tracks/c/exercises/pangram/test/test_pangram.c +8 -0
- data/tracks/c/exercises/pascals-triangle/test/test_pascals_triangle.c +8 -0
- data/tracks/c/exercises/perfect-numbers/src/example.c +4 -4
- data/tracks/c/exercises/perfect-numbers/src/example.h +4 -4
- data/tracks/c/exercises/perfect-numbers/src/perfect_numbers.h +4 -4
- data/tracks/c/exercises/perfect-numbers/test/test_perfect_numbers.c +23 -13
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +8 -0
- data/tracks/c/exercises/raindrops/test/test_raindrops.c +5 -1
- data/tracks/c/exercises/react/src/example.c +8 -8
- data/tracks/c/exercises/react/test/test_react.c +8 -0
- data/tracks/c/exercises/rna-transcription/test/test_rna_transcription.c +8 -0
- data/tracks/c/exercises/robot-simulator/src/example.c +12 -12
- data/tracks/c/exercises/robot-simulator/src/robot_simulator.h +11 -11
- data/tracks/c/exercises/robot-simulator/test/test_robot_simulator.c +33 -25
- data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +8 -0
- data/tracks/c/exercises/scrabble-score/test/test_scrabble_score.c +8 -0
- data/tracks/c/exercises/series/test/test_series.c +8 -0
- data/tracks/c/exercises/sieve/test/test_sieve.c +8 -0
- data/tracks/c/exercises/space-age/src/example.h +8 -8
- data/tracks/c/exercises/space-age/test/test_space_age.c +16 -8
- data/tracks/c/exercises/sum-of-multiples/test/test_sum_of_multiples.c +8 -0
- data/tracks/c/exercises/triangle/test/test_triangle.c +8 -0
- data/tracks/c/exercises/word-count/test/test_word_count.c +8 -0
- data/tracks/cfml/config.json +8 -0
- data/tracks/cfml/exercises/anagram/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/anagram/Anagram.cfc +13 -0
- data/tracks/cfml/exercises/anagram/AnagramTest.cfc +79 -0
- data/tracks/cfml/exercises/anagram/README.md +29 -0
- data/tracks/cfml/exercises/anagram/Solution.cfc +42 -0
- data/tracks/cfml/exercises/anagram/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/anagram/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/anagram/box.json +8 -0
- data/tracks/cfml/exercises/anagram/index.cfm +37 -0
- data/tracks/common-lisp/config.json +5 -5
- data/tracks/csharp/exercises/two-bucket/Example.cs +53 -79
- data/tracks/csharp/exercises/two-bucket/TwoBucketTest.cs +2 -2
- data/tracks/csharp/generators/Exercises/QueenAttack.cs +3 -3
- data/tracks/dart/exercises/leap/test/leap_test.dart +1 -1
- data/tracks/delphi/exercises/hamming/uHammingTests.pas +2 -2
- data/tracks/delphi/exercises/leap/uLeapTests.pas +11 -38
- data/tracks/delphi/exercises/nucleotide-count/uNucleotideCountExample.pas +1 -1
- data/tracks/delphi/exercises/nucleotide-count/uNucleotideCountTest.pas +31 -55
- data/tracks/ecmascript/config.json +31 -0
- data/tracks/ecmascript/config/maintainers.json +5 -5
- data/tracks/ecmascript/exercises/accumulate/package.json +1 -1
- data/tracks/ecmascript/exercises/acronym/package.json +1 -1
- data/tracks/ecmascript/exercises/all-your-base/package.json +1 -1
- data/tracks/ecmascript/exercises/allergies/package.json +1 -1
- data/tracks/ecmascript/exercises/alphametics/package.json +1 -1
- data/tracks/ecmascript/exercises/anagram/package.json +1 -1
- data/tracks/ecmascript/exercises/atbash-cipher/package.json +1 -1
- data/tracks/ecmascript/exercises/beer-song/package.json +1 -1
- data/tracks/ecmascript/exercises/binary-search-tree/package.json +1 -1
- data/tracks/ecmascript/exercises/binary-search/package.json +1 -1
- data/tracks/ecmascript/exercises/binary/package.json +1 -1
- data/tracks/ecmascript/exercises/bob/package.json +1 -1
- data/tracks/ecmascript/exercises/bracket-push/package.json +1 -1
- data/tracks/ecmascript/exercises/circular-buffer/package.json +1 -1
- data/tracks/ecmascript/exercises/clock/package.json +1 -1
- data/tracks/ecmascript/exercises/collatz-conjecture/README.md +59 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/collatz-conjecture.spec.js +31 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/example.js +14 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/package.json +69 -0
- data/tracks/ecmascript/exercises/connect/package.json +1 -1
- data/tracks/ecmascript/exercises/crypto-square/package.json +1 -1
- data/tracks/ecmascript/exercises/custom-set/package.json +1 -1
- data/tracks/ecmascript/exercises/diamond/package.json +1 -1
- data/tracks/ecmascript/exercises/difference-of-squares/package.json +1 -1
- data/tracks/ecmascript/exercises/diffie-hellman/package.json +1 -1
- data/tracks/ecmascript/exercises/etl/package.json +1 -1
- data/tracks/ecmascript/exercises/flatten-array/package.json +1 -1
- data/tracks/ecmascript/exercises/food-chain/package.json +1 -1
- data/tracks/ecmascript/exercises/gigasecond/package.json +1 -1
- data/tracks/ecmascript/exercises/grade-school/package.json +1 -1
- data/tracks/ecmascript/exercises/grains/package.json +1 -1
- data/tracks/ecmascript/exercises/hamming/package.json +1 -1
- data/tracks/ecmascript/exercises/hello-world/package.json +1 -1
- data/tracks/ecmascript/exercises/hexadecimal/package.json +1 -1
- data/tracks/ecmascript/exercises/isogram/package.json +1 -1
- data/tracks/ecmascript/exercises/kindergarten-garden/package.json +1 -1
- data/tracks/ecmascript/exercises/largest-series-product/package.json +1 -1
- data/tracks/ecmascript/exercises/leap/package.json +1 -1
- data/tracks/ecmascript/exercises/linked-list/package.json +1 -1
- data/tracks/ecmascript/exercises/list-ops/package.json +1 -1
- data/tracks/ecmascript/exercises/luhn/package.json +1 -1
- data/tracks/ecmascript/exercises/matrix/package.json +1 -1
- data/tracks/ecmascript/exercises/meetup/package.json +1 -1
- data/tracks/ecmascript/exercises/minesweeper/package.json +1 -1
- data/tracks/ecmascript/exercises/nth-prime/package.json +1 -1
- data/tracks/ecmascript/exercises/ocr-numbers/package.json +1 -1
- data/tracks/ecmascript/exercises/octal/package.json +1 -1
- data/tracks/ecmascript/exercises/palindrome-products/package.json +1 -1
- data/tracks/ecmascript/exercises/pangram/package.json +1 -1
- data/tracks/ecmascript/exercises/pascals-triangle/package.json +1 -1
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +1 -1
- data/tracks/ecmascript/exercises/phone-number/package.json +1 -1
- data/tracks/ecmascript/exercises/pig-latin/package.json +1 -1
- data/tracks/ecmascript/exercises/prime-factors/package.json +1 -1
- data/tracks/ecmascript/exercises/proverb/package.json +1 -1
- data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +1 -1
- data/tracks/ecmascript/exercises/queen-attack/package.json +1 -1
- data/tracks/ecmascript/exercises/raindrops/package.json +1 -1
- data/tracks/ecmascript/exercises/rna-transcription/package.json +1 -1
- data/tracks/ecmascript/exercises/robot-name/package.json +1 -1
- data/tracks/ecmascript/exercises/robot-simulator/package.json +1 -1
- data/tracks/ecmascript/exercises/roman-numerals/package.json +1 -1
- data/tracks/ecmascript/exercises/run-length-encoding/package.json +1 -1
- data/tracks/ecmascript/exercises/saddle-points/package.json +1 -1
- data/tracks/ecmascript/exercises/say/package.json +1 -1
- data/tracks/ecmascript/exercises/scrabble-score/package.json +1 -1
- data/tracks/ecmascript/exercises/secret-handshake/package.json +1 -1
- data/tracks/ecmascript/exercises/series/package.json +1 -1
- data/tracks/ecmascript/exercises/sieve/package.json +1 -1
- data/tracks/ecmascript/exercises/simple-cipher/package.json +1 -1
- data/tracks/ecmascript/exercises/simple-linked-list/package.json +1 -1
- data/tracks/ecmascript/exercises/space-age/package.json +1 -1
- data/tracks/ecmascript/exercises/strain/package.json +1 -1
- data/tracks/ecmascript/exercises/sublist/package.json +1 -1
- data/tracks/ecmascript/exercises/sum-of-multiples/package.json +1 -1
- data/tracks/ecmascript/exercises/triangle/package.json +1 -1
- data/tracks/ecmascript/exercises/trinary/package.json +1 -1
- data/tracks/ecmascript/exercises/twelve-days/package.json +1 -1
- data/tracks/ecmascript/exercises/two-bucket/package.json +1 -1
- data/tracks/ecmascript/exercises/word-count/package.json +1 -1
- data/tracks/ecmascript/exercises/word-search/README.md +58 -0
- data/tracks/ecmascript/exercises/word-search/example.js +146 -0
- data/tracks/ecmascript/exercises/word-search/package.json +69 -0
- data/tracks/ecmascript/exercises/word-search/word-search.spec.js +626 -0
- data/tracks/ecmascript/exercises/wordy/package.json +1 -1
- data/tracks/ecmascript/package.json +1 -1
- data/tracks/elixir/config.json +11 -0
- data/tracks/elixir/exercises/luhn/example.exs +26 -46
- data/tracks/elixir/exercises/luhn/luhn.exs +0 -13
- data/tracks/elixir/exercises/luhn/luhn_test.exs +44 -14
- data/tracks/elixir/exercises/transpose/README.md +101 -0
- data/tracks/elixir/exercises/transpose/example.exs +46 -0
- data/tracks/elixir/exercises/transpose/transpose.exs +22 -0
- data/tracks/elixir/exercises/transpose/transpose_test.exs +248 -0
- data/tracks/fsharp/exercises/grains/Example.fs +10 -2
- data/tracks/fsharp/exercises/grains/Grains.fs +2 -4
- data/tracks/fsharp/exercises/grains/GrainsTest.fs +52 -25
- data/tracks/fsharp/exercises/phone-number/Example.fs +11 -3
- data/tracks/fsharp/exercises/phone-number/PhoneNumber.fs +1 -1
- data/tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs +32 -21
- data/tracks/fsharp/exercises/prime-factors/Example.fs +6 -13
- data/tracks/fsharp/exercises/prime-factors/PrimeFactors.fs +1 -1
- data/tracks/fsharp/exercises/prime-factors/PrimeFactorsTest.fs +23 -32
- data/tracks/fsharp/exercises/rail-fence-cipher/RailFenceCipherTest.fs +22 -13
- data/tracks/fsharp/generators/Exercise.fs +3 -4
- data/tracks/fsharp/generators/Generators.fs +31 -0
- data/tracks/gnu-apl/bin/run-all-tests +5 -2
- data/tracks/java/CONTRIBUTING.md +8 -0
- data/tracks/java/POLICIES.md +2 -2
- data/tracks/java/config.json +26 -4
- data/tracks/java/exercises/triangle/.meta/.version +1 -0
- data/tracks/java/exercises/triangle/.meta/src/reference/java/Triangle.java +1 -1
- data/tracks/java/exercises/triangle/src/test/java/TriangleTest.java +59 -40
- data/tracks/javascript/config.json +30 -0
- data/tracks/javascript/config/maintainers.json +8 -8
- data/tracks/javascript/exercises/change/example.js +6 -22
- data/tracks/javascript/exercises/collatz-conjecture/README.md +57 -0
- data/tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js +37 -0
- data/tracks/javascript/exercises/collatz-conjecture/example.js +20 -0
- data/tracks/javascript/exercises/protein-translation/example.js +30 -31
- data/tracks/javascript/exercises/protein-translation/protein-translation.spec.js +60 -60
- data/tracks/javascript/exercises/transpose/README.md +89 -0
- data/tracks/javascript/exercises/transpose/example.js +17 -0
- data/tracks/javascript/exercises/transpose/transpose.spec.js +67 -0
- data/tracks/objective-c/config.json +283 -263
- data/tracks/objective-c/exercises/grains/GrainsExample.h +6 -0
- data/tracks/objective-c/exercises/grains/GrainsExample.m +19 -0
- data/tracks/objective-c/exercises/grains/GrainsTest.m +85 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeExample.h +6 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeExample.m +39 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeTest.m +53 -0
- data/tracks/python/config.json +42 -11
- data/tracks/python/exercises/change/README.md +34 -0
- data/tracks/python/exercises/two-bucket/README.md +47 -0
- data/tracks/ruby/README.md +4 -1
- data/tracks/ruby/lib/generator/command_line.rb +3 -3
- data/tracks/ruby/lib/generator/command_line/generator_optparser.rb +3 -3
- data/tracks/ruby/test/generator/command_line/generator_optparser_test.rb +4 -4
- data/tracks/ruby/test/generator/command_line_test.rb +5 -5
- data/tracks/typescript/config.json +15 -0
- data/tracks/typescript/exercises/strain/README.md +60 -0
- data/tracks/typescript/exercises/strain/package.json +36 -0
- data/tracks/typescript/exercises/strain/strain.example.ts +23 -0
- data/tracks/typescript/exercises/strain/strain.test.ts +76 -0
- data/tracks/typescript/exercises/strain/strain.ts +0 -0
- data/tracks/typescript/exercises/strain/tsconfig.json +22 -0
- data/tracks/typescript/exercises/strain/tslint.json +127 -0
- data/tracks/typescript/exercises/strain/yarn.lock +2305 -0
- metadata +46 -3
- data/tracks/ecmascript/package-lock.json +0 -2835
@@ -0,0 +1,19 @@
|
|
1
|
+
#import "GrainsExample.h"
|
2
|
+
@implementation Grains : NSObject
|
3
|
+
|
4
|
+
-(long long)grainsAtSquareNumber:(int)squareNo {
|
5
|
+
if (squareNo <= 64 && squareNo > 0) {
|
6
|
+
return pow(2, squareNo - 1);
|
7
|
+
}
|
8
|
+
return -1;
|
9
|
+
}
|
10
|
+
|
11
|
+
-(long long)grainsAtBoard {
|
12
|
+
long long total = 0;
|
13
|
+
for (int i = 1; i <= 64; i++) {
|
14
|
+
total += [self grainsAtSquareNumber:i];
|
15
|
+
}
|
16
|
+
return total;
|
17
|
+
}
|
18
|
+
|
19
|
+
@end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#import <XCTest/XCTest.h>
|
2
|
+
|
3
|
+
#if __has_include("GrainsExample.h")
|
4
|
+
# import "GrainsExample.h"
|
5
|
+
# else
|
6
|
+
# import "Grains.h"
|
7
|
+
#endif
|
8
|
+
|
9
|
+
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
11
|
+
|
12
|
+
@interface GrainsTest : XCTestCase
|
13
|
+
|
14
|
+
@end
|
15
|
+
|
16
|
+
@implementation GrainsTest
|
17
|
+
|
18
|
+
- (void)testNumberOfGrainsOnSquare1 {
|
19
|
+
long long expected = 1;
|
20
|
+
long long result = [[[Grains alloc]init]grainsAtSquareNumber:1];
|
21
|
+
XCTAssertEqual(expected,result);
|
22
|
+
}
|
23
|
+
|
24
|
+
- (void)testNumberOfGrainsOnSquare2 {
|
25
|
+
long long expected = 2;
|
26
|
+
long long result = [[[Grains alloc]init]grainsAtSquareNumber:2];
|
27
|
+
XCTAssertEqual(expected,result);
|
28
|
+
}
|
29
|
+
|
30
|
+
- (void)testNumberOfGrainsOnSquare3 {
|
31
|
+
unsigned long long expected = 4;
|
32
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:3];
|
33
|
+
XCTAssertEqual(expected,result);
|
34
|
+
}
|
35
|
+
|
36
|
+
- (void)testNumberOfGrainsOnSquare4 {
|
37
|
+
unsigned long long expected = 8;
|
38
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:4];
|
39
|
+
XCTAssertEqual(expected,result);
|
40
|
+
}
|
41
|
+
|
42
|
+
- (void)testNumberOfGrainsOnSquare16 {
|
43
|
+
unsigned long long expected = 32768;
|
44
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:16];
|
45
|
+
XCTAssertEqual(expected,result);
|
46
|
+
}
|
47
|
+
|
48
|
+
- (void)testNumberOfGrainsOnSquare32 {
|
49
|
+
unsigned long long expected = 2147483648;
|
50
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:32];
|
51
|
+
XCTAssertEqual(expected,result);
|
52
|
+
}
|
53
|
+
|
54
|
+
- (void)testNumberOfGrainsOnSquare64 {
|
55
|
+
unsigned long long expected = 9223372036854775808;
|
56
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:64];
|
57
|
+
XCTAssertEqual(expected,result);
|
58
|
+
}
|
59
|
+
|
60
|
+
- (void)testNumberOfGrainsOnSquare65 {
|
61
|
+
unsigned long long expected = -1;
|
62
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:65];
|
63
|
+
XCTAssertEqual(expected,result);
|
64
|
+
}
|
65
|
+
|
66
|
+
- (void)testNumberOfGrainsOnSquareNeg1 {
|
67
|
+
unsigned long long expected = -1;
|
68
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:-1];
|
69
|
+
XCTAssertEqual(expected,result);
|
70
|
+
}
|
71
|
+
|
72
|
+
- (void)testNumberOfGrainsOnSquare0 {
|
73
|
+
unsigned long long expected = -1;
|
74
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtSquareNumber:0];
|
75
|
+
XCTAssertEqual(expected,result);
|
76
|
+
}
|
77
|
+
|
78
|
+
- (void)testTotalNumberOfGrains {
|
79
|
+
unsigned long long expected = 18446744073709551615;
|
80
|
+
unsigned long long result = [[[Grains alloc]init]grainsAtBoard];
|
81
|
+
XCTAssertEqual(expected,result);
|
82
|
+
}
|
83
|
+
|
84
|
+
@end
|
85
|
+
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#import "NthPrimeExample.h"
|
2
|
+
@implementation NthPrime : NSObject
|
3
|
+
|
4
|
+
+(int)primeNum:(int)primeNum {
|
5
|
+
if (primeNum == 0) {
|
6
|
+
return 0;
|
7
|
+
}
|
8
|
+
int currentPrime = 0;
|
9
|
+
int i = 0;
|
10
|
+
while (currentPrime <= primeNum) {
|
11
|
+
i += 1;
|
12
|
+
if ([self isPrime:i]){
|
13
|
+
currentPrime += 1;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
return i;
|
17
|
+
}
|
18
|
+
+(BOOL)isPrime:(int)n {
|
19
|
+
if (n == 2 || n == 3) {
|
20
|
+
return YES;
|
21
|
+
}
|
22
|
+
|
23
|
+
if (n % 2 == 0 || n % 3 == 0) {
|
24
|
+
return NO;
|
25
|
+
}
|
26
|
+
|
27
|
+
int i = 5;
|
28
|
+
int w = 2;
|
29
|
+
while (i * i <= n) {
|
30
|
+
if (n % i == 0) {
|
31
|
+
return NO;
|
32
|
+
}
|
33
|
+
i += w;
|
34
|
+
w = 6 - w;
|
35
|
+
}
|
36
|
+
return YES;
|
37
|
+
}
|
38
|
+
|
39
|
+
@end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#import <XCTest/XCTest.h>
|
2
|
+
|
3
|
+
#if __has_include("BobExample.h")
|
4
|
+
# import "NthPrimeExample.h"
|
5
|
+
#else
|
6
|
+
# import "NthPrime.h"
|
7
|
+
#endif
|
8
|
+
|
9
|
+
NS_ASSUME_NONNULL_BEGIN
|
10
|
+
|
11
|
+
@interface NthPrimeTest : XCTestCase
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@implementation NthPrimeTest
|
16
|
+
|
17
|
+
- (void)testFirstPrime {
|
18
|
+
int primeNum = 1;
|
19
|
+
int expected = 2;
|
20
|
+
int result = [NthPrime primeNum:primeNum];
|
21
|
+
XCTAssertEqual(expected, result);
|
22
|
+
}
|
23
|
+
|
24
|
+
- (void)testSecondPrime {
|
25
|
+
int primeNum = 2;
|
26
|
+
int expected = 3;
|
27
|
+
int result = [NthPrime primeNum:primeNum];
|
28
|
+
XCTAssertEqual(expected, result);
|
29
|
+
}
|
30
|
+
|
31
|
+
- (void)testSixthPrime {
|
32
|
+
int primeNum = 6;
|
33
|
+
int expected = 13;
|
34
|
+
int result = [NthPrime primeNum:primeNum];
|
35
|
+
XCTAssertEqual(expected, result);
|
36
|
+
}
|
37
|
+
|
38
|
+
- (void)testBigPrime {
|
39
|
+
int primeNum = 10001;
|
40
|
+
int expected = 104743;
|
41
|
+
int result = [NthPrime primeNum:primeNum];
|
42
|
+
XCTAssertEqual(expected, result);
|
43
|
+
}
|
44
|
+
|
45
|
+
- (void)testZeroPrime {
|
46
|
+
int primeNum = 0;
|
47
|
+
int expected = 0;
|
48
|
+
int result = [NthPrime primeNum:primeNum];
|
49
|
+
XCTAssertEqual(expected, result);
|
50
|
+
}
|
51
|
+
|
52
|
+
@end
|
53
|
+
NS_ASSUME_NONNULL_END
|
data/tracks/python/config.json
CHANGED
@@ -288,7 +288,7 @@
|
|
288
288
|
"topics": [
|
289
289
|
"loops",
|
290
290
|
"logic",
|
291
|
-
"conditionals"
|
291
|
+
"conditionals"
|
292
292
|
]
|
293
293
|
},
|
294
294
|
{
|
@@ -298,8 +298,11 @@
|
|
298
298
|
"unlocked_by": null,
|
299
299
|
"difficulty": 1,
|
300
300
|
"topics": [
|
301
|
-
|
302
|
-
|
301
|
+
"arrays",
|
302
|
+
"classes",
|
303
|
+
"optional_values",
|
304
|
+
"variables"
|
305
|
+
]
|
303
306
|
},
|
304
307
|
{
|
305
308
|
"uuid": "aadde1a8-ed7a-4242-bfc0-6dddfd382cf3",
|
@@ -308,7 +311,12 @@
|
|
308
311
|
"unlocked_by": null,
|
309
312
|
"difficulty": 1,
|
310
313
|
"topics": [
|
311
|
-
|
314
|
+
"conditionals",
|
315
|
+
"strings",
|
316
|
+
"integers",
|
317
|
+
"lists",
|
318
|
+
"filtering",
|
319
|
+
"sorting"
|
312
320
|
]
|
313
321
|
},
|
314
322
|
{
|
@@ -328,7 +336,12 @@
|
|
328
336
|
"unlocked_by": null,
|
329
337
|
"difficulty": 1,
|
330
338
|
"topics": [
|
331
|
-
|
339
|
+
"conditionals",
|
340
|
+
"loops",
|
341
|
+
"integers",
|
342
|
+
"strings",
|
343
|
+
"logic",
|
344
|
+
"mathematics"
|
332
345
|
]
|
333
346
|
},
|
334
347
|
{
|
@@ -338,7 +351,10 @@
|
|
338
351
|
"unlocked_by": null,
|
339
352
|
"difficulty": 1,
|
340
353
|
"topics": [
|
341
|
-
|
354
|
+
"mathematics",
|
355
|
+
"floating_point_numbers",
|
356
|
+
"integers",
|
357
|
+
"conditionals"
|
342
358
|
]
|
343
359
|
},
|
344
360
|
{
|
@@ -368,7 +384,9 @@
|
|
368
384
|
"unlocked_by": null,
|
369
385
|
"difficulty": 1,
|
370
386
|
"topics": [
|
371
|
-
|
387
|
+
"loops",
|
388
|
+
"maps",
|
389
|
+
"transforming"
|
372
390
|
]
|
373
391
|
},
|
374
392
|
{
|
@@ -417,7 +435,10 @@
|
|
417
435
|
"unlocked_by": null,
|
418
436
|
"difficulty": 1,
|
419
437
|
"topics": [
|
420
|
-
|
438
|
+
"loops",
|
439
|
+
"strings",
|
440
|
+
"games",
|
441
|
+
"maps"
|
421
442
|
]
|
422
443
|
},
|
423
444
|
{
|
@@ -563,7 +584,14 @@
|
|
563
584
|
"unlocked_by": null,
|
564
585
|
"difficulty": 1,
|
565
586
|
"topics": [
|
566
|
-
|
587
|
+
"conditionals",
|
588
|
+
"loops",
|
589
|
+
"lists",
|
590
|
+
"integers",
|
591
|
+
"bitwise_operations",
|
592
|
+
"logic",
|
593
|
+
"mathematics",
|
594
|
+
"transforming"
|
567
595
|
]
|
568
596
|
},
|
569
597
|
{
|
@@ -585,7 +613,8 @@
|
|
585
613
|
"unlocked_by": null,
|
586
614
|
"difficulty": 1,
|
587
615
|
"topics": [
|
588
|
-
|
616
|
+
"mathematics",
|
617
|
+
"loops"
|
589
618
|
]
|
590
619
|
},
|
591
620
|
{
|
@@ -798,7 +827,9 @@
|
|
798
827
|
"unlocked_by": null,
|
799
828
|
"difficulty": 1,
|
800
829
|
"topics": [
|
801
|
-
|
830
|
+
"strings",
|
831
|
+
"lists",
|
832
|
+
"loops"
|
802
833
|
]
|
803
834
|
},
|
804
835
|
{
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Change
|
2
|
+
|
3
|
+
Correctly determine the fewest number of coins to be given to a customer such
|
4
|
+
that the sum of the coins' value would equal the correct amount of change.
|
5
|
+
|
6
|
+
## For example
|
7
|
+
|
8
|
+
- An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5)
|
9
|
+
and one dime (10) or [0, 1, 1, 0, 0]
|
10
|
+
- An input of 40 with [1, 5, 10, 25, 100] should return one nickel (5)
|
11
|
+
and one dime (10) and one quarter (25) or [0, 1, 1, 1, 0]
|
12
|
+
|
13
|
+
## Edge cases
|
14
|
+
|
15
|
+
- Does your algorithm work for any given set of coins?
|
16
|
+
- Can you ask for negative change?
|
17
|
+
- Can you ask for a change value smaller than the smallest coin value?
|
18
|
+
|
19
|
+
### Submitting Exercises
|
20
|
+
|
21
|
+
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
22
|
+
|
23
|
+
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
|
24
|
+
|
25
|
+
|
26
|
+
For more detailed information about running tests, code style and linting,
|
27
|
+
please see the [help page](http://exercism.io/languages/python).
|
28
|
+
|
29
|
+
## Source
|
30
|
+
|
31
|
+
Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata)
|
32
|
+
|
33
|
+
## Submitting Incomplete Solutions
|
34
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Two Bucket
|
2
|
+
|
3
|
+
Given two buckets of different size, demonstrate how to measure an exact number of liters by strategically transferring liters of fluid between the buckets.
|
4
|
+
|
5
|
+
Since this mathematical problem is fairly subject to interpretation / individual approach, the tests have been written specifically to expect one overarching solution.
|
6
|
+
|
7
|
+
To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches!
|
8
|
+
|
9
|
+
Your program will take as input:
|
10
|
+
- the size of bucket one, passed as a numeric value
|
11
|
+
- the size of bucket two, passed as a numeric value
|
12
|
+
- the desired number of liters to reach, passed as a numeric value
|
13
|
+
- which bucket to fill first, passed as a String (either 'one' or 'two')
|
14
|
+
|
15
|
+
Your program should determine:
|
16
|
+
- the total number of "moves" it should take to reach the desired number of liters, including the first fill - expects a numeric value
|
17
|
+
- which bucket should end up with the desired number of liters (let's say this is bucket A) - expects a String (either 'one' or 'two')
|
18
|
+
- how many liters are left in the other bucket (bucket B) - expects a numeric value
|
19
|
+
|
20
|
+
Note: any time a change is made to either or both buckets counts as one (1) move.
|
21
|
+
|
22
|
+
Example:
|
23
|
+
Bucket one can hold up to 7 liters, and bucket two can hold up to 11 liters. Let's say bucket one, at a given step, is holding 7 liters, and bucket two is holding 8 liters (7,8). If you empty bucket one and make no change to bucket two, leaving you with 0 liters and 8 liters respectively (0,8), that counts as one "move". Instead, if you had poured from bucket one into bucket two until bucket two was full, leaving you with 4 liters in bucket one and 11 liters in bucket two (4,11), that would count as only one "move" as well.
|
24
|
+
|
25
|
+
To conclude, the only valid moves are:
|
26
|
+
- pouring from one bucket to another
|
27
|
+
- emptying one bucket and doing nothing to the other
|
28
|
+
- filling one bucket and doing nothing to the other
|
29
|
+
|
30
|
+
Written with <3 at [Fullstack Academy](http://www.fullstackacademy.com/) by [Lindsay](http://lindsaylevine.com).
|
31
|
+
|
32
|
+
### Submitting Exercises
|
33
|
+
|
34
|
+
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
35
|
+
|
36
|
+
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
|
37
|
+
|
38
|
+
|
39
|
+
For more detailed information about running tests, code style and linting,
|
40
|
+
please see the [help page](http://exercism.io/languages/python).
|
41
|
+
|
42
|
+
## Source
|
43
|
+
|
44
|
+
Water Pouring Problem [http://demonstrations.wolfram.com/WaterPouringProblem/](http://demonstrations.wolfram.com/WaterPouringProblem/)
|
45
|
+
|
46
|
+
## Submitting Incomplete Solutions
|
47
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
data/tracks/ruby/README.md
CHANGED
@@ -106,7 +106,10 @@ tree -L 1 ~/code/exercism
|
|
106
106
|
|
107
107
|
From within the ruby directory, run the following command:
|
108
108
|
|
109
|
-
bin/generate <slug>
|
109
|
+
bin/generate --update <slug>
|
110
|
+
|
111
|
+
Leaving out the --update option will cause the BookKeeping version number to remain the same.
|
112
|
+
This can be useful when testing generators.
|
110
113
|
|
111
114
|
#### Changing a Generated Exercise
|
112
115
|
|
@@ -29,11 +29,11 @@ module Generator
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def generator_class
|
32
|
-
|
32
|
+
update? ? UpdateVersionAndGenerateTests : GenerateTests
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
@options[:
|
35
|
+
def update?
|
36
|
+
@options[:update]
|
37
37
|
end
|
38
38
|
|
39
39
|
def implementation(slug)
|