//createArrayOfFunctions
function createArrayOfFunctions(y) {
var arr = [];
for(var i = 0; i<y; i++) {
arr[i] = function(x) { return x + i; }
//createArrayOfFunctions
function createArrayOfFunctions(y) {
var arr = [];
for(var i = 0; i<y; i++) {
arr[i] = function(x) { return x + i; }
| // Write a function that takes an array of integers as input. For each integer, output the next | |
| // fibonacci number. | |
| // Fibonacci number of Fn is defined by: | |
| // Fn = Fn-1 + Fn-2 | |
| // F1 = 1, F2 = 1 | |
| // Your program should run correctly for the first 60 Fibonacci Numbers. | |
| // For example: | |
| // nextFibonacci([1,9,22]) | |
| // Output: | |
| // 2 |
The computational complexity of my answer in Question 1:
| // Write a function that takes two arrays as input, each array contains a list of A-Z; Your program | |
| // should return True if the 2nd array is a subset of 1st array, or False if not. | |
| // For example: | |
| // isSubset([A,B,C,D,E], [A,E,D]) = true | |
| // isSubset([A,B,C,D,E], [A,D,Z]) = false | |
| // isSubset([A,D,E], [A,A,D,E]) = true | |
| bool isSubset(vector<int> &arr1, vector<int> &arr2) { | |
| map<int,bool> m; | |