Retired

Is the operation associative? (retired)

Description:

In mathematics, a binary operation over the integers, denoted by an operator # and having two arguments, is associative if and only if:

a # (b # c) = (a # b) # c for all values of a, b, and c.

Your task is to determine if the provided operator is mathematically associative or not and return true or false respectively.

All inputs will be valid and selected from built-in operators used for arithmetic and passed in as strings.

Example:

'-' is not an associative operator since for all values of a, b, and c it is not true that: a - (b - c) = (a - b) - c.

Taking a, b, c = 7 we can see that subtraction is not an associative operation:

7 - (7 - 7) != (7 - 7) - 7
7 - 0       !=  0 - 7
7           != -7
Input: '-' => false
Mathematics

Similar Kata:

Stats:

CreatedOct 11, 2022
Warriors Trained16
Total Skips0
Total Code Submissions44
Total Times Completed15
JavaScript Completions15
Total Stars0
% of votes with a positive feedback rating56% of 9
Total "Very Satisfied" Votes4
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes3
Total Rank Assessments10
Average Assessed Rank
8 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • learningalwayslearning Avatar
Ad