Code Monkey home page Code Monkey logo

dashdevs-task-solution's Introduction

dashdevs-task-solution

Task:

Purpose of the technical specification: Implement an algorithm for searching for an equilibrium index in an array of integers. Description. The equilibrium index in an array is defined as the index at which the sum of the elements on the left is equal to the sum of the elements on the right. In other words, it is an index at which the sum of the array elements before that index is equal to the sum of the elements after it. For example, in the array 1, 7, 3, 6, 5, 6, the equilibrium index is 3 because the sum of the elements to the left of index 3 (1 + 7 + 3 is 11) is equal to the sum of the elements to the right of index 3 (5 + 6 is 11) . If the equilibrium index is not found, the function should return -1.

Solution

The task was solved using the cli interface and containerized in docker. The task was divided into logical modules in which logic, validation, processing, testing and interface are atomically performed. The input list was also validated and tests were written in the test.

How to install

Copy solution from github repo:

git clone [email protected]:yevhenii-nevmyvako/dashdevs-task-solution.git

Install requirements & setup the project:

python -m venv venv
pip install -e .

If you wont install in docker: go to your project folder and run command:

docker build -t <name:tag> . 
How to run without docker

list create from string with integer values.

find_index '5,6,5'

Save result to json file with optional flag -f

find_index '5,6,5' -f path/to/save_result.json
How to run with docker

list create from string with integer values.

docker run <name:tag> find_index '5,6,5'

Save result to json file with optional flag -f

docker run find_index '5,6,5' -f path/to/save_result.json

dashdevs-task-solution's People

Contributors

yevhenii-nevmyvako 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.