Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanbrasiliano/code-challenge-geekhunter-platform
Technical challenge for the geekhunter platform made in PHP and with the aim of gaining access to the vacancies offered by the website.
https://github.com/yanbrasiliano/code-challenge-geekhunter-platform
algorithms challenge php
Last synced: about 4 hours ago
JSON representation
Technical challenge for the geekhunter platform made in PHP and with the aim of gaining access to the vacancies offered by the website.
- Host: GitHub
- URL: https://github.com/yanbrasiliano/code-challenge-geekhunter-platform
- Owner: yanbrasiliano
- License: mit
- Created: 2023-01-14T14:58:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-04T01:36:01.000Z (5 months ago)
- Last Synced: 2024-06-04T03:08:28.906Z (5 months ago)
- Topics: algorithms, challenge, php
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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