Git Product home page Git Product logo

sunsethills's Introduction

Sunset Hills Challenge MiniSite

This is a complete minisite that contains a visual representation of the "Sunset Hills" challenge.

Screenshot

This project was created using Bootstrap 4.5, HTML5, CSS3, and JavaScript. All logic & JavaScript DOM changes were custom coded for this project.

What is the "Sunset Hills" challenge?

Sunset Hills is an array manipulation challenge: the sun is setting in the West, and from West to East the heights of each building is given in an integer array. Which of the buildings can see the sunset?

This challenge or a slight variation has been used by technology companies such as Amazon and was also featured on a Geeks for Geeks blog post titled “Amazon Interview Experience | Set 189 (For SDE-1)”

Installation

You can view this site live.

To download and run locally, clone this repository and open index.html.

git clone https://github.com/joshpters/SunsetHills

Core Function

This is a basic form of the function that determines which buildings can see the sunset.

The minisite has a modified version of this function to work with the page animations & grid generation.

//sunset hills algorithm
function sunsetHills(buildingHeights) {
    let sunsetHillsOutput = new Array();
    let highestBuilding = 0;
    for (i = 0; i < buildingHeights.length; i++) {
        if (buildingHeights[i] <= highestBuilding) {
            sunsetHillsOutput.push(false);
            continue;
        }
        highestBuilding = buildingHeights[i];
        sunsetHillsOutput.push(true);
    }
    //output will be an array of booleans
    return sunsetHillsOutput;
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

sunsethills's People

Contributors

joshpters avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.