diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/gamma-function.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/gamma-function.english.md index b2671431f5..82f9e4059b 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/gamma-function.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/gamma-function.english.md @@ -46,7 +46,7 @@ tests:
[ [3,"Fizz"] , [5,"Buzz"] ]
.
+The first will be an array with the FizzBuzz rules. For example: [ [3, "Fizz"] , [5, "Buzz"] ]
.
This indcates that Fizz
should be printed if the number is a multiple of 3 and Buzz
if it is a multiple of 5. If it is a multiple of both then the strings should be concatenated in the order specified in the array. In this case, FizzBuzz
if the number is a multiple of 3 and 5.
The second parameter is the number for which the function should return a string as stated above.
['a','b','c','d']
.
+Write a function to generate an array of lower case ASCII characters for a given range. For example, given the range ['a', 'd']
, the function should return ['a', 'b', 'c', 'd']
.
if b[i-1] = 1
g[i] = not b[i]
else
g[i] = b[i]
-
Or: g = b xor (b logically right shifted 1 time)
b[0] = g[0]
for other bits:
b[i] = g[i] xor b[i-1]
+It is also useful for generating inputs for Karnaugh maps in order from left to right or top to bottom.
+if b[i-1] = 1 + g[i] = not b[i] +else + g[i] = b[i] ++Or: +
+g = b xor (b logically right shifted 1 time) ++Decoding (MSB is bit 0, b is binary, g is Gray code): +
+b[0] = g[0]
+for other bits: +b[i] = g[i] xor b[i-1] +
maximumSubsequence
should be a function.
testString: assert(typeof maximumSubsequence=='function','maximumSubsequence
should be a function.');
- - text: maximumSubsequence([1,2,-1,3,10,-10])
should return an array.
- testString: assert(Array.isArray(maximumSubsequence([1,2,-1,3,10,-10])),'maximumSubsequence([1,2,-1,3,10,-10])
should return an array.');
- - text: maximumSubsequence([1,2,-1,3,10,-10])
should return [ 1, 2, -1, 3, 10 ]
.
- testString: assert.deepEqual(maximumSubsequence([1,2,-1,3,10,-10]), [ 1, 2, -1, 3, 10 ],'maximumSubsequence([1,2,-1,3,10,-10])
should return [ 1, 2, -1, 3, 10 ]
.');
- - text: maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3])
should return [ 0, 8, 10 ]
.
- testString: assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [ 0, 8, 10 ],'maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3])
should return [ 0, 8, 10 ]
.');
- - text: maximumSubsequence([9, 9, -10, 1])
should return [ 9, 9 ]
.
- testString: assert.deepEqual(maximumSubsequence([9, 9, -10, 1]), [ 9, 9 ],'maximumSubsequence([9, 9, -10, 1])
should return [ 9, 9 ]
.');
- - text: maximumSubsequence([7, 1, -5, -3, -8, 1]
should return [ 7, 1 ]
.
- testString: assert.deepEqual(maximumSubsequence([7, 1, -5, -3, -8, 1]), [ 7, 1 ],'maximumSubsequence([7, 1, -5, -3, -8, 1]
should return [ 7, 1 ]
.');
- - text: maximumSubsequence([-3, 6, -1, 4, -4, -6])
should return [ 6, -1, 4 ]
.
- testString: assert.deepEqual(maximumSubsequence([-3, 6, -1, 4, -4, -6]), [ 6, -1, 4 ],'maximumSubsequence([-3, 6, -1, 4, -4, -6])
should return [ 6, -1, 4 ]
.');
- - text: maximumSubsequence([-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1])
should return [ 3, 5, 6, -2, -1, 4 ]
.
- testString: assert.deepEqual(maximumSubsequence([-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1]), [ 3, 5, 6, -2, -1, 4 ],'maximumSubsequence([-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1])
should return [ 3, 5, 6, -2, -1, 4 ]
.');
+ - text: maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])
should return an array.
+ testString: assert(Array.isArray(maximumSubsequence([ 1, 2,-1, 3, 10, -10 ])),'maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])
should return an array.');
+ - text: maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])
should return [ 1, 2, -1, 3, 10 ]
.
+ testString: assert.deepEqual(maximumSubsequence([1,2,-1,3,10,-10]), [ 1, 2, -1, 3, 10 ],'maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])
should return [ 1, 2, -1, 3, 10 ]
.');
+ - text: maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])
should return [ 0, 8, 10 ]
.
+ testString: assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [ 0, 8, 10 ],'maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])
should return [ 0, 8, 10 ]
.');
+ - text: maximumSubsequence([ 9, 9, -10, 1 ])
should return [ 9, 9 ]
.
+ testString: assert.deepEqual(maximumSubsequence([ 9, 9, -10, 1 ]), [ 9, 9 ],'maximumSubsequence([ 9, 9, -10, 1 ])
should return [ 9, 9 ]
.');
+ - text: maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]
should return [ 7, 1 ]
.
+ testString: assert.deepEqual(maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]), [ 7, 1 ],'maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]
should return [ 7, 1 ]
.');
+ - text: maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])
should return [ 6, -1, 4 ]
.
+ testString: assert.deepEqual(maximumSubsequence([ -3, 6, -1, 4, -4, -6 ]), [ 6, -1, 4 ],'maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])
should return [ 6, -1, 4 ]
.');
+ - text: maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])
should return [ 3, 5, 6, -2, -1, 4 ]
.
+ testString: assert.deepEqual(maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ]), [ 3, 5, 6, -2, -1, 4 ],'maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])
should return [ 3, 5, 6, -2, -1, 4 ]
.');
```
@@ -47,7 +47,7 @@ tests: