7 kyu

Find the middle element

16,774 of 36,926myTerminal

Description:

As a part of this Kata, you need to create a function that when provided with a triplet, returns the index of the numerical element that lies between the other two elements.

The input to the function will be an array of three distinct numbers (Haskell: a tuple).

For example:

gimme([2, 3, 1]) => 0

2 is the number that fits between 1 and 3 and the index of 2 in the input array is 0.

Another example (just to make sure it is clear):

gimme([5, 10, 14]) => 1

10 is the number that fits between 5 and 14 and the index of 10 in the input array is 1.

Arrays
Fundamentals

Stats:

CreatedNov 5, 2014
PublishedNov 5, 2014
Warriors Trained60656
Total Skips8473
Total Code Submissions103789
Total Times Completed36926
JavaScript Completions16774
Python Completions14691
CoffeeScript Completions32
Ruby Completions1602
Haskell Completions503
C# Completions1706
Rust Completions746
C Completions536
Go Completions879
COBOL Completions12
Factor Completions16
Total Stars434
% of votes with a positive feedback rating93% of 3926
Total "Very Satisfied" Votes3410
Total "Somewhat Satisfied" Votes462
Total "Not Satisfied" Votes54
Total Rank Assessments365
Average Assessed Rank
6 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • myTerminal Avatar
  • jhoffner Avatar
  • bkaes Avatar
  • GiacomoSorbi Avatar
  • ahitt6345 Avatar
  • CrazyMerlyn Avatar
  • RVdeKoning Avatar
  • Chrono79 Avatar
  • barakplasma Avatar
  • Voile Avatar
  • Souzooka Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • username0 Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • tri@ Avatar
Ad