From 610571ee8a7046cd0f9dc38c5c8af488771103f8 Mon Sep 17 00:00:00 2001 From: victorotene Date: Sun, 25 Sep 2022 14:54:51 +0100 Subject: [PATCH 1/5] add first factorial question - victor --- week2/victor/first_factorial.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 week2/victor/first_factorial.md diff --git a/week2/victor/first_factorial.md b/week2/victor/first_factorial.md new file mode 100644 index 0000000..9c4824f --- /dev/null +++ b/week2/victor/first_factorial.md @@ -0,0 +1,16 @@ +--- +Author: Victor +Date: 2022-09-25 +--- + +First Factorial + + +Have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it. + +For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24. For the test cases, the range will be between 1 and 18 and the input will always be an integer. +Examples +Input: 4 +Output: 24 +Input: 8 +Output: 40320 \ No newline at end of file From 6abe143d4d37fe6fadae5454364a4acaeb1c86c0 Mon Sep 17 00:00:00 2001 From: victorotene Date: Mon, 17 Oct 2022 23:11:36 +0100 Subject: [PATCH 2/5] question --- week4/victor/comments.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/week4/victor/comments.md b/week4/victor/comments.md index e69de29..7b5d9ce 100644 --- a/week4/victor/comments.md +++ b/week4/victor/comments.md @@ -0,0 +1,12 @@ +--- +Author: Victor +Date: 2022-10-17 +--- + +Word Count +Have the function WordCount(str) take the str string parameter being passed and return the number of words the string contains (e.g. "Never eat shredded wheat or cake" would return 6). Words will be separated by single spaces. +Examples +Input: "Hello World" +Output: 2 +Input: "one 22 three" +Output: 3 From aa343926e5eecad56174e66f25440bd0630ea7ae Mon Sep 17 00:00:00 2001 From: victorotene Date: Mon, 17 Oct 2022 23:12:15 +0100 Subject: [PATCH 3/5] word_count answer --- week4/victor/Word_count.js | 10 ++++++++++ week4/victor/Word_count.md | 0 week5/victor/comments.md | 0 3 files changed, 10 insertions(+) create mode 100644 week4/victor/Word_count.js create mode 100644 week4/victor/Word_count.md create mode 100644 week5/victor/comments.md diff --git a/week4/victor/Word_count.js b/week4/victor/Word_count.js new file mode 100644 index 0000000..787301a --- /dev/null +++ b/week4/victor/Word_count.js @@ -0,0 +1,10 @@ + + +function WordCount(str) { + let words = str.split(' '); + return words.length; + +} + +// keep this function call here +WordCount(readline()); \ No newline at end of file diff --git a/week4/victor/Word_count.md b/week4/victor/Word_count.md new file mode 100644 index 0000000..e69de29 diff --git a/week5/victor/comments.md b/week5/victor/comments.md new file mode 100644 index 0000000..e69de29 From bbb68c55bb7c829b032bb91f2fa4210f308be63f Mon Sep 17 00:00:00 2001 From: victorotene Date: Wed, 7 Dec 2022 05:56:48 +0100 Subject: [PATCH 4/5] ArithGeo --- week13/Victor/ArithGeo.jsx | 34 ++++++++++++++++++++++++++++++++++ week13/Victor/ArithGeo.md | 13 +++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 week13/Victor/ArithGeo.jsx create mode 100644 week13/Victor/ArithGeo.md diff --git a/week13/Victor/ArithGeo.jsx b/week13/Victor/ArithGeo.jsx new file mode 100644 index 0000000..4263b2a --- /dev/null +++ b/week13/Victor/ArithGeo.jsx @@ -0,0 +1,34 @@ +function ArithGeoII(arr) { + var num1 = arr[0]; + var num2 = arr[1]; + var arithmetic = num2 - num1; + var geometric = num2 / num1; + + var isArithmetic = true; + var isGeometric = true; + + for (var i = 0; i < arr.length-1; i++) { + var first = arr[i]; + var second = arr[i+1]; + + if (second / first !== geometric) { + isGeometric = false; + } + + if ((second - first) !== arithmetic) { + isArithmetic = false; + } + + } + + if (isGeometric) { + return 'Geometric' + } else if (isArithmetic) { + return 'Arithmetic' + } else { + return -1 + } +} + +// keep this function call here +ArithGeoII(readline()); \ No newline at end of file diff --git a/week13/Victor/ArithGeo.md b/week13/Victor/ArithGeo.md new file mode 100644 index 0000000..aa5c391 --- /dev/null +++ b/week13/Victor/ArithGeo.md @@ -0,0 +1,13 @@ +--- +Author: Victor +Date: 7-12-22 +--- + + +Arith Geo II +Have the function ArithGeoII(arr) take the array of numbers stored in arr and return the string "Arithmetic" if the sequence follows an arithmetic pattern or return "Geometric" if it follows a geometric pattern. If the sequence doesn't follow either pattern return -1. An arithmetic sequence is one where the difference between each of the numbers is consistent, where as in a geometric sequence, each term after the first is multiplied by some constant or common ratio. Arithmetic example: [2, 4, 6, 8] and Geometric example: [2, 6, 18, 54]. Negative numbers may be entered as parameters, 0 will not be entered, and no array will contain all the same elements. +Examples +Input: [5,10,15] +Output: Arithmetic +Input: [2,4,16,24] +Output: -1 \ No newline at end of file From 31a35f98cab7caf82a33b97c62648b4a17f03272 Mon Sep 17 00:00:00 2001 From: victorotene Date: Wed, 7 Dec 2022 05:57:00 +0100 Subject: [PATCH 5/5] comment --- week13/Victor/comment.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 week13/Victor/comment.md diff --git a/week13/Victor/comment.md b/week13/Victor/comment.md new file mode 100644 index 0000000..e69de29