Categories

AdjacentElementsProduct | CodeFights Intro Algorithm JavaScript Solution and Breakdown



AdjacentElementsProduct | CodeFights Intro Algorithm JavaScript Solution and Breakdown
Support our Community:
-Donate:
-Patreon:
-Code, Tech and Caffeine Facebook Group:
-Discord:
– Looking for a a Bootcamp check out DevMountain’s program where housing is included with the tuition:

Tutoring, Mentoring and Course Walkthroughs available:

Thank you to my Patreon Supporters Below:
-Check out youtube.com/user/cardinalslinkyband

Support me and visit my store at:

Internship, Part-Time, & Full time work for college students and recent grads:

Fan funding goes towards buying the equipment necessary to deliver 4k videos, 4k webcam, and a high quality microphone better audio. Any support is very appreciated!

My channel is here for aspiring programmers to learn easier and help debug any issues from the many great free resources available on the web.

Check out my other videos going over HTML, CSS, Ruby, Ruby on Rails, Java, JavaScript, Python, PHP, SQL, Command Line, BootStrap, jQuery, and WordPress from CodeCademy, CodeCombat, FreeCodecamp and more!

-~-~~-~~~-~~-~-
Please watch: “How I Became a Developer | My Developer Journey of the Last 3 Years | Ask a Dev”

-~-~~-~~~-~~-~-

Nguồn: https://tintucgame.net

Xem thêm bài viết khác: https://tintucgame.net/giai-tri/

Article Categories:
Giải Trí

Comments

  • it is not true

    web developer club March 27, 2020 12:41 pm Reply
  • Can you please update your code like this?

    function adjacentElementsProduct(inputArray: number[]): number {
    let largestproduct = inputArray[0] * inputArray[inputArray.length-1];
    for(let i=0; i < inputArray.length-1; i++)
    {
    const product = inputArray[i] * inputArray[i+1]
    largestproduct = largestproduct < product ? product :largestproduct;
    }
    return largestproduct;
    }
    console.log(adjacentElementsProduct([3, 6, -2, -5 ,7, 3]));

    Omar Hasan March 27, 2020 12:41 pm Reply
  • I could not do with PHP, it error in test 8 …. can anyone help me?

    Leonardo Carvalho March 27, 2020 12:41 pm Reply
  • That was really helpful, thanks

    Christian Rodier March 27, 2020 12:41 pm Reply
  • I don't know you but I'm glad I came across your videos

    Jonathan Mendoza March 27, 2020 12:41 pm Reply
  • damn son

    Nonnie Martin March 27, 2020 12:41 pm Reply
  • dude this is exactly what I have but it says time limit exceeded

    c l March 27, 2020 12:41 pm Reply
  • How do you not get a rangeError at the last iteration of your loop? You are looking for an item at a spot that does not exist then: inputArray[i+1].
    Does JS not mind if you do that?

    Rook March 27, 2020 12:41 pm Reply
  • this was a huge jump from the previous challenge "checkPalidrome", this is way beyond me -_-

    Marc Droz March 27, 2020 12:41 pm Reply
  • ternary operator is also called a conditional statement

    Sarthak March 27, 2020 12:41 pm Reply
  • This is my solution 🙂

    let arr = [0,1,2,3,4,5,4];

    Array.prototype.prod = function(i) {
    return this[i] * this[i+1];
    }

    function maxProd(arr) {
    let productsArr = [];
    for (let i = 0; i < arr.length – 1; i++) {
    productsArr.push(arr.prod(i));
    }
    return Math.max(…productsArr);
    }

    console.log(maxProd(arr));

    Topsoil Depletion Awareness (closing the loop) March 27, 2020 12:41 pm Reply
  • Oh! my solution was pretty similar to yours. I used a traditional if-statement rather than the es6 version.

    Dev Material March 27, 2020 12:41 pm Reply
  • first comment woot

    Ksee March 27, 2020 12:41 pm Reply

Leave a Reply

Your email address will not be published. Required fields are marked *