Code Monkey home page Code Monkey logo

clicks-exercise's Introduction

solution_enrique_gonzalez

Test Assignment

NodeJS, npm and javascript are the main components of this application.

Requirements

Given an array of clicks, return the subset of clicks where:

  1. For each IP within each one hour period, only the most expensive click is placed into the result set.
  2. If more than one click from the same IP ties for the most expensive click in a one hour period, only place the earliest click into the result set.
  3. If there are more than 10 clicks for an IP in the overall array of clicks, do not include any of those clicks in the result set. The result set should be stored in an array of hashes. Each hash should represent a click. The expected result set should be a subset of the original array.

Before starting

NodeJS and NPM must be installed in order to run this scripts

Test Cases

Jest has been used for basic unit testing

List of Files Used

  1. index.js - Main file that will load json data, start dataset processing and download resultset.json file.
  2. Click.js - Entity that provides all the functionality related to Click items.
  3. click.json - Raw dataset.
  4. test folder - Contains all the necessary items for testing 4.1. test_data.js - Test file input and output data 4.2 test.js - File in charge of execute test cases
  5. resultset.json - Stores the final dataset.

Installation

  1. Unzip the folder solution_Enrique_Gonzalez.zip.
  2. Install dependencies using command npm i

Execute the code

Command to execute code and retrieve new dataset: npm run solution

Command to run the test cases: npm run test

clicks-exercise's People

Contributors

enriquecms16 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.