7 kyu

Operations with sequence

118 of 1,355arkada38

Description:

Steps

  1. Square the numbers that are greater than zero.
  2. Multiply by 3 every third number.
  3. Multiply by -1 every fifth number.
  4. Return the sum of the sequence.

Example
{ -2, -1, 0, 1, 2 } returns -6

1. { -2, -1, 0, 1 * 1, 2 * 2 }
2. { -2, -1, 0 * 3, 1, 4 }
3. { -2, -1, 0, 1, -1 * 4 }
4. -6

P.S.: The sequence consists only of integers. And try not to use "for", "while" or "loop" statements.

Fundamentals
Arrays

More By Author:

Check out these other kata created by arkada38

Stats:

CreatedJul 18, 2017
PublishedJul 18, 2017
Warriors Trained2055
Total Skips53
Total Code Submissions4068
Total Times Completed1355
C# Completions118
JavaScript Completions463
Python Completions472
Rust Completions240
R Completions77
Haskell Completions63
Total Stars21
% of votes with a positive feedback rating89% of 304
Total "Very Satisfied" Votes247
Total "Somewhat Satisfied" Votes45
Total "Not Satisfied" Votes12
Total Rank Assessments53
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • arkada38 Avatar
  • sv90 Avatar
  • imjasonmiller Avatar
  • Voile Avatar
  • hobovsky Avatar
  • saudiGuy Avatar
Ad