7 kyu
Orthogonal Vectors
126 of 1,869user3043623
Description:
Suppose I have two vectors: (a1, a2, a3, ..., aN)
and (b1, b2, b3, ..., bN)
. The dot product between these two vectors is defined as:
a1*b1 + a2*b2 + a3*b3 + ... + aN*bN
The vectors are classified as orthogonal if the dot product equals zero.
Complete the function that accepts two sequences as inputs and returns true
if the vectors are orthogonal, and false
if they are not. The sequences will always be correctly formatted and of the same length, so there is no need to check them first.
Examples
[1, 1, 1], [2, 5, 7] --> false
[1, 0, 0, 1], [0, 1, 1, 0] --> true
Physics
Mathematics
Algorithms
Similar Kata:
Stats:
Created | May 5, 2014 |
Published | May 5, 2014 |
Warriors Trained | 2561 |
Total Skips | 40 |
Total Code Submissions | 3898 |
Total Times Completed | 1869 |
Ruby Completions | 126 |
JavaScript Completions | 752 |
CoffeeScript Completions | 12 |
Python Completions | 1013 |
Haskell Completions | 23 |
Java Completions | 38 |
Total Stars | 18 |
% of votes with a positive feedback rating | 92% of 343 |
Total "Very Satisfied" Votes | 293 |
Total "Somewhat Satisfied" Votes | 45 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 30 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |