From fd29e19aa10d9c8fbc19a26c50bc99357fcc2ec3 Mon Sep 17 00:00:00 2001 From: Daniel Ramos Date: Wed, 8 Apr 2015 01:25:34 -0700 Subject: [PATCH 1/2] adds answers to fibonacci sequence and combinations of n pairs of parentheses functions --- app/recursion.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/app/recursion.js b/app/recursion.js index 4a374b6..2606cff 100644 --- a/app/recursion.js +++ b/app/recursion.js @@ -73,6 +73,41 @@ define(function() { temp.slice() ); } + }, + + fibonacci: function(n) { + function fib(n) { + if (n <= 1) + return n; + return fib(n-1) + fib(n-2); + } + + return fib(n); + }, + + validParentheses: function(n) { + var validParentheses = []; + + brackets('', 0, 0, n); + + function brackets(bracket, open, close, pairs) + { + if( (open===pairs) && (close===pairs) ) + { + validParentheses.push(bracket); + } + else + { + if (open Date: Wed, 8 Apr 2015 01:51:43 -0700 Subject: [PATCH 2/2] Fix jshint: Expected an assignment or function call and instead saw an expression. --- app/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/count.js b/app/count.js index e8c3e9f..b3fd41d 100644 --- a/app/count.js +++ b/app/count.js @@ -16,7 +16,7 @@ define(function () { return { cancel : function () { - timeout && clearTimeout(timeout); + clearTimeout(timeout); } }; }