Giter VIP home page Giter VIP logo

code-challenge-geekhunter-platform's Introduction

Geekhunter Challenge

Proposed Scenary:

You are a developer at a digital marketing company. Each potential customer registered through the web site is directed to a specific sales person, following a simple distribution queue. Each salesperson who receives a potential customer takes the last place in the distribution queue. This ensures that, fairly, all salespeople have the opportunity to achieve sales of the product/service offered by the company.

Challenge:

Based on the initial state of the distribution queue, which is given by the vector of IDs of the registered salespersons, you need to be able to establish its state after the registration of a number N of customers, showing who is the first salesperson in the queue and how many customers need to register for the salesperson of ID X to get to the front of the queue.

Example: for the initial queue state F=[3, 6, 8, 4, 7], after C=4 registered customers the resulting queue state will be R=[4, 7, 3, 6, 8], since:

After the first registered customer the queue will have the state [6, 8, 4, 7, 3] After the second registration the queue will have the state [8, 4, 7, 3, 6]. After the third registration the resulting state will be [4, 7, 3, 6, 8]. Finally, after the third registration the resulting state will be [7, 3, 6, 8, 4]

For this resulting state we can then conclude that the salesperson occupying the first position in the queue is the one with ID 7.

We can also conclude that for the sales person with id 3 to reach the front of the queue, 1 more customer must be registered.

Input Format (all input lines are of type string):

The first line contains the number of items in the vendor queue V The second line contains the space-separated ids of the salesmen in the initial queue state F The third line contains the number of registered customers C The fourth line contains the ID of one of the salespersons X

Output format:

You need to print two lines as the result

The first line should contain the ID of the salesperson who occupies the first position in the resulting queue state after the number C of registered customers. The second line should contain the number of customers that need to register in order for salesperson X to get to the front of the queue

code-challenge-geekhunter-platform's People

Contributors

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