Code Monkey home page Code Monkey logo

customer-success-balancing-rd's Introduction

Ruby

Solving the CustomerSuccess Balancing Challenge

What is the challenge?

The challenge is to create a system to balance customers for customer success. So some rules have to be respected such as: customer level, customer success level, how much each customer success can and cannot serve.

How I solved?

Initially I thought I would order the customer data and customer success data, and then I would be able to work with this data. I thought this way first, because I realized that the inputs were disordered, so it was necessary to first order them based on the score and then start working with the data.

After this, we could move on to the balancing itself. Within the balancing algorithms we think of Round And Robbin, Hash, Minimum Connections and etc. But, the challenge is not about load balancing itself, but about clients based on score. This way, we thought of the following condition: For a customer success to receive a customer, the customer's score needs to be less than or equal to your score. However, this would not fit for all cases, because there was a possibility that a customer success would not receive a customer, so we needed to add one more condition: the customer's score must be higher than the previous customer success. This way we were able to create a match algorithm for customers and customer success.

After finalizing the selection of customers for the customer success, we then have to create a data grouping, so we can define which customer success received the most customers and return them. Therefore, we used ruby's group_by method to create this grouping, then sorting in descending order and choosing the first value, because it will generate two effects: transformation of a hash into an array, highest result first.

How to run the test

In the terminal, run the command below:

ruby customer_success_balancing.rb

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.