Test task for Wonderobe
Implement a program that allows shift operations on an array. During the shift, the addition of adjacent elements occurs if they are equal.
The program interface supports the --help
option, which displays a brief help text:
> node index.js --help
or shortcut:
> node index.js -h
-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
Empty input
- an empty string has been transmitted or the value is missingInput is too small
- in user input the number of elements is less than 2Could not find separator into the input
- an invalid line delimiter was sent or the delimiter is missing from the lineFound specific char
- sinput contains "special" charactersSome char into the input is not a number
- the input contains data other than numbersSome number into the input not a power of 2
- the input contains numbers that are not a power of 2Some number into the input is 0
- input contains 0