Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript function, for loops, linear time complexity


function crossAdd(input) {
    var answer = [];
    for (var i = 0; i < input.length; i++) {
        var goingUp = input[i];
        var goingDown = input[input.length-1-i];
        answer.push(goingUp + goingDown);
    }
    return answer;
}
// O(N) time complexity

                    
Comment

PREVIOUS NEXT
Code Example
Javascript :: return axios response from seperate file 
Javascript :: count selected gridview rows in javascript 
Javascript :: using jquery to extend textarea 
Javascript :: javascript compare dates old new value 
Javascript :: javascript csv einlesen-jqueryAjax 
Javascript :: sequelize default curdate 
Javascript :: dev console with colored font 
Javascript :: lieke 
Javascript :: nice password generator 
Javascript :: triangle sum of odds numbers formula 
Javascript :: show dropdown upwards and downward 
Javascript :: react native carriage return 
Javascript :: enable bootrstrap duellistbox from my own js 
Javascript :: alterar estilo com getElements 
Javascript :: Raphael JS store arbitrary data 
Javascript :: javascript paragraph class 
Javascript :: knex update and list all record mysql 
Javascript :: window location host vs origin 
Javascript :: jquery element by name 
Javascript :: AjaxGet 
Javascript :: read url jsf 
Javascript :: javascript online programming test 
Javascript :: React sub count 
Javascript :: ERROR in ./node_modules/pretty-format/node_modules/ansi-regex/index.js Module build failed: Error: ENOENT: no such file or directory 
Javascript :: firebase check if key exists javascript 
Javascript :: KIVIN 
Javascript :: dynamic copyright year JavaScript centre aligned 
Javascript :: one dimensional array in javascript 
Javascript :: circular objects javascript 
Javascript :: how to make your own version of filter method 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =