7 kyu

N-Dimensional Vector Magnitude

392 of 954ByteSheep

Description:

Return the magnitude of a vector, given as an array of its component values.

The vector (2, 3, 5) would be represented as an array containing three values at indices 0, 1 and 2 respectively.
The array will always contain at least 2 and at most 100 elements (2 ≤ vector.Length ≤ 100), each of which will be within the range [-100, 100].
An array containing four elements represents a vector in 4D space.

More info on finding the length of a vector: http://farside.ph.utexas.edu/teaching/301/lectures/node28.html

Arrays
Fundamentals

More By Author:

Check out these other kata created by ByteSheep

Stats:

CreatedOct 19, 2016
PublishedOct 19, 2016
Warriors Trained1695
Total Skips94
Total Code Submissions1832
Total Times Completed954
C# Completions118
Java Completions219
JavaScript Completions195
Python Completions392
Ruby Completions46
PHP Completions83
Haskell Completions17
Total Stars17
% of votes with a positive feedback rating89% of 226
Total "Very Satisfied" Votes182
Total "Somewhat Satisfied" Votes38
Total "Not Satisfied" Votes6
Total Rank Assessments9
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • ByteSheep Avatar
  • raulbc777 Avatar
  • donaldsebleung Avatar
  • user5036852 Avatar
  • JohanWiltink Avatar
  • hobovsky Avatar
  • tobeannouncd Avatar
  • Just4FunCoder Avatar
Ad