Coder Social home page Coder Social logo

eric-souza / bitcoin-sales-cashback-puzzle Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9 KB

An algorithm, developed in Javascript, that solves a puzzle about a list of bitcoins's sales and associated cashbacks. This algorithm was developed as Zro Bank's software engineering entrance test (www.zrobank.com.br).

JavaScript 100.00%
javascript node backend bitcoin cashback puzzle algorithms data-structures fs

bitcoin-sales-cashback-puzzle's Introduction

Bitcoin Sales Cashbacks

Procedure

This algorithm reads two files (sales.csv and cashback.csv) into memory and, for each sale, processes the data and finds an associated cashback (by checking if its timestamp is within five seconds of the sale's timestamp).

The output of this script should be as follows:

  • The ID of the sale.
  • The timestamp of the sale in ISO 8601 format.
  • The amount of the sale in Brazilian Reais, formatted with two decimal places.
  • If no associated cashback exists, the next fields should be null.

Otherwise, they should be as the following:

  • The ID of the associated cashback.
  • The timestamp of the associated cashback in ISO 8601 format.
  • The amount of the cashback in Bitcoins, formatted with eight decimal places.
  • The price of Bitcoin, knowing that the cashback is supposed to be 0.5% of the value of the sale. The price of Bitcoin is the amount in Reais divided by the amount in Bitcoins.

To run the code, type in the root folder:

node index.js

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.