Skip to main content
added 90 characters in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14
  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are different, zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output
  • You needn't handle invalid input like "Diminished 1st", "Major 4th" or "Perfect 2nd".
Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd

or testing friendly,

[m,2]+[M,3]=[0,4]
[M,2]+[M,2]=[M,3]
[M,3]+[M,3]=[1,5]
[1,2]+[1,3]=[3,4]
[-2,6]+[-2,7]=[-5,12]
[1,1]+[m,2]=[M,2]
  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are different, zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output
Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd
  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are different, zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output
  • You needn't handle invalid input like "Diminished 1st", "Major 4th" or "Perfect 2nd".
Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd

or testing friendly,

[m,2]+[M,3]=[0,4]
[M,2]+[M,2]=[M,3]
[M,3]+[M,3]=[1,5]
[1,2]+[1,3]=[3,4]
[-2,6]+[-2,7]=[-5,12]
[1,1]+[m,2]=[M,2]
added 11 characters in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14

Sum of Two Intervals

A k-th interval plus an m-th interval is a (k+m-1)th interval. An interval with p semitones plus one with q semitones is one with (p+q) semitones. Given two intervals, get their sum. Relations between interval and semitones is listed below.

Interval Double
Diminished
Diminished Minor Perfect Major Augmented Double
Augmented
unison
(1st)
-2* -1* - 0 - 1 2
2nd -1* 0 1 - 2 3 4
3rd 1 2 3 - 4 5 6
4th 3 4 - 5 - 6 7
5th 5 6 - 7 - 8 9
6th 6 7 8 - 9 10 11
7th 8 9 10 - 11 12 13
octave
(8th)
10 11 - 12 - 13 14

* Negative distance doesn't exist but it can be added 12 until non-negative

For larger interval, k-th interval has 12 more semitones than the same type of (k-7)-th interval. Triple Augmented is 1 more semitone than Double Augmented, Triple Diminished is 1 less semitone than Double Diminished, etc.

IO format

  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are different, zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output

Test cases

Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd

Sum of Two Intervals

A k-th interval plus an m-th interval is a (k+m-1)th interval. An interval with p semitones plus one with q semitones is one with (p+q) semitones. Given two intervals, get their sum. Relations between interval and semitones is listed below.

Interval Double
Diminished
Diminished Minor Perfect Major Augmented Double
Augmented
unison
(1st)
-2* -1* - 0 - 1 2
2nd -1* 0 1 - 2 3 4
3rd 1 2 3 - 4 5 6
4th 3 4 - 5 - 6 7
5th 5 6 - 7 - 8 9
6th 6 7 8 - 9 10 11
7th 8 9 10 - 11 12 13
octave
(8th)
10 11 - 12 - 13 14

* Negative distance doesn't exist but it can be added 12 until non-negative

For larger interval, k-th interval has 12 more semitones than the same type of (k-7)-th interval. Triple Augmented is 1 more semitone than Double Augmented, Triple Diminished is 1 less semitone than Double Diminished, etc.

IO format

  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output

Test cases

Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd

Sum of Two Intervals

A k-th interval plus an m-th interval is a (k+m-1)th interval. An interval with p semitones plus one with q semitones is one with (p+q) semitones. Given two intervals, get their sum. Relations between interval and semitones is listed below.

Interval Double
Diminished
Diminished Minor Perfect Major Augmented Double
Augmented
unison
(1st)
-2* -1* - 0 - 1 2
2nd -1* 0 1 - 2 3 4
3rd 1 2 3 - 4 5 6
4th 3 4 - 5 - 6 7
5th 5 6 - 7 - 8 9
6th 6 7 8 - 9 10 11
7th 8 9 10 - 11 12 13
octave
(8th)
10 11 - 12 - 13 14

* Negative distance doesn't exist but it can be added 12 until non-negative

For larger interval, k-th interval has 12 more semitones than the same type of (k-7)-th interval. Triple Augmented is 1 more semitone than Double Augmented, Triple Diminished is 1 less semitone than Double Diminished, etc.

IO format

  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are different, zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output

Test cases

Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd
added 1 character in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14

Sum of Two Intervals

A k-th interval plus an m-th interval is a (k+m-1)th interval. An interval with p semitones plus one with q semitones is one with (p+q) semitones. Given two intervals, get their sum. Relations between interval and semitones is listed below.

Interval Double
Diminished
Diminished Minor Perfect Major Augmented Double
Augmented
unison
(1st)
-2* -1* - 0 - 1 2
2nd -1* 0 1 - 2 3 4
3rd 1 2 3 - 4 5 6
4th 3 4 - 5 - 6 7
5th 5 6 - 7 - 8 9
6th 6 7 8 - 9 10 11
7th 8 9 10 - 11 12 13
octave
(8th)
10 11 - 12 - 13 14

* Negative distance doesn't exist but it can be added 12 until non-negative

For larger interval, k-th interval has 12 more semitones than the same type of (k-7)-th interval. Triple Augmented is 1 more semitone than Double Augmented, Triple Diminished is 1 less semitone than Double Diminished, etc.

IO format

  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are zero or non-numberinteger
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output

Test cases

Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd

Sum of Two Intervals

A k-th interval plus an m-th interval is a (k+m-1)th interval. An interval with p semitones plus one with q semitones is one with (p+q) semitones. Given two intervals, get their sum. Relations between interval and semitones is listed below.

Interval Double
Diminished
Diminished Minor Perfect Major Augmented Double
Augmented
unison
(1st)
-2* -1* - 0 - 1 2
2nd -1* 0 1 - 2 3 4
3rd 1 2 3 - 4 5 6
4th 3 4 - 5 - 6 7
5th 5 6 - 7 - 8 9
6th 6 7 8 - 9 10 11
7th 8 9 10 - 11 12 13
octave
(8th)
10 11 - 12 - 13 14

* Negative distance doesn't exist but it can be added 12 until non-negative

For larger interval, k-th interval has 12 more semitones than the same type of (k-7)-th interval. Triple Augmented is 1 more semitone than Double Augmented, Triple Diminished is 1 less semitone than Double Diminished, etc.

IO format

  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are zero or non-number
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output

Test cases

Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd

Sum of Two Intervals

A k-th interval plus an m-th interval is a (k+m-1)th interval. An interval with p semitones plus one with q semitones is one with (p+q) semitones. Given two intervals, get their sum. Relations between interval and semitones is listed below.

Interval Double
Diminished
Diminished Minor Perfect Major Augmented Double
Augmented
unison
(1st)
-2* -1* - 0 - 1 2
2nd -1* 0 1 - 2 3 4
3rd 1 2 3 - 4 5 6
4th 3 4 - 5 - 6 7
5th 5 6 - 7 - 8 9
6th 6 7 8 - 9 10 11
7th 8 9 10 - 11 12 13
octave
(8th)
10 11 - 12 - 13 14

* Negative distance doesn't exist but it can be added 12 until non-negative

For larger interval, k-th interval has 12 more semitones than the same type of (k-7)-th interval. Triple Augmented is 1 more semitone than Double Augmented, Triple Diminished is 1 less semitone than Double Diminished, etc.

IO format

  • The interval would likely get inputted as one argument
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -2/-1/a/b/c/1/2, where a, b, c are zero or non-integer
  • You can take Double Diminished/Diminished/Minor/Perfect/Major/Augmented/Double Augmented as -3/-2/-1/0/1/2/3
  • Same applies to output

Test cases

Minor 2nd + Major 3rd = Perfect 4th
Major 2nd + Major 2nd = Major 3rd
Major 3rd + Major 3rd = Augmented 5th
Augmented 2nd + Augmented 3rd = Triple Augmented 4th
Double Diminished 6th + Double Diminished 7th = 5 Times Diminished 12th
Augmented 1st + Minor 2nd = Major 2nd
added 22 characters in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14
Loading
Source Link
l4m2
  • 28.5k
  • 12
  • 14
Loading