Coder Social home page Coder Social logo

clicks_js's Introduction

solution_Nikhita_Zulka

Test Assessment

Have made use of node, npm and javascript while creating this solution.

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.

Prerequisites

Please make sure that NODE is installed on the device where this code needs to be run. NPM will be used to run any command from shell/terminal to run the code.

Test Cases

Mocha is used for writing test in this. Test cases are written only on basic level for now.

List of Files Used

  1. index.js - The main file that will execute the code and call the required functions with the actual data (json data).
  2. computeData.js - Main logic function, that accets the clicks_object array and return the resulted array.
  3. saveFileToJSON.js - Saves the array recieved as argument to the JSON file.
  4. test.js - Executes test cases.
  5. test_inputs.js - Holds the Test file's input and output data.
  6. resultset.json - Stores the final output.

Installation Process

First, unzip the folder and open the terminal on the extracted folder. Second, use the package manager 'npm' to install all the required packages, using command npm i or npm install in the terminal.

Running the code

Command to run the solution: npm run solution

Command to run the test cases: npm run test

clicks_js's People

Contributors

nikx12 avatar

Watchers

James Cloos avatar  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.