Code Monkey home page Code Monkey logo

shifter's Introduction

shifter

Test task for Wonderobe

Short text of the task

Implement a program that allows shift operations on an array. During the shift, the addition of adjacent elements occurs if they are equal.

Usage

The program interface supports the --help option, which displays a brief help text:

> node index.js --help

or shortcut:

> node index.js -h

Possible option list:

  • -h | --help - displays a short help text
  • -n | --input=1,2,4 - user input. an array of data represented like a string with a separator. Attention! 0 in this case is not considered a power of 2. Example: 1,2,4
  • -i | --interactive - interactive mode of the program in which the program interacts with the user. If option is not used, program will use automatic mode in which array processing occurs without user intervention.
  • -z | --with_zeros - the option includes the addition of array 0 after the shift, i.e. array length does not change
  • -s | --separator=',' - option defines a delimiter for user input

Possible Errors:

  1. Empty input - an empty string has been transmitted or the value is missing
  2. Input is too small - in user input the number of elements is less than 2
  3. Could not find separator into the input - an invalid line delimiter was sent or the delimiter is missing from the line
  4. Found specific char - sinput contains "special" characters
  5. Some char into the input is not a number - the input contains data other than numbers
  6. Some number into the input not a power of 2 - the input contains numbers that are not a power of 2
  7. Some number into the input is 0 - input contains 0

shifter's People

Contributors

ruddy22 avatar

Watchers

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