6 kyu
Coding 3min : Excel Puzzle #2
76 of 104myjinxin2015
Description:
This is the simple version of Fastest Code series. If you need some challenges, please try the Performance version
Task:
You are given two arguments: excel
(number array), like this:[1 ,2 ,3 ,4 ,5 ,6]
, and n
(an index of target number)
Return the rank of excel[n].
The rank means, when excel
in ascending order, what is its position.
In this simple version, excel length range: 5...99, elements of excel value range: 0...99
Some example to help you understand the rules:
( [1,2,3,4,5], 0) => 1
rank: 1 2 3 4 5
[0]=1, rank of number 1 is 1
( [1,2,3,4,5], 1) => 2
rank: 1 2 3 4 5
[1]=2, rank of number 2 is 2
( [5,4,3,2,1], 0) => 5
rank: 5 4 3 2 1
[0]=5, rank of number 5 is 5
( [5,4,3,2,1], 1) => 4
rank: 5 4 3 2 1
[1]=4, rank of number 4 is 4
so easy? see other examples:
( [1,2,2,2,3], 1) => 2
rank: 1 2 3 4 5
the same number have different ranks,
the number of smaller indexes is in front of others.
[1]=2, rank of first number 2 is 2
( [1,2,2,2,3], 2) => 3
rank: 1 2 3 4 5
[2]=2, rank of second number 2 is 3
( [2,2,2,2,2], 2) => 3
rank: 1 2 3 4 5
[2]=2, rank of 3rd number 2 is 3
Please use the sort function carefully, because the original array should not be changed.
Series:
- Bug in Apple
- Father and Son
- Jumping Dutch act
- Planting Trees
- Give me the equation
- Find the murderer
- Reading a Book
- Eat watermelon
- Special factor
- Guess the Hat
- Symmetric Sort
- Are they symmetrical?
- Max Value
- Trypophobia
- Virus in Apple
- Balance Attraction
- Remove screws I
- Remove screws II
- Regular expression compression
- Collatz Array(Split or merge)
- Tidy up the room
- Waiting for a Bus
Puzzles
Games
Similar Kata:
Stats:
Created | Apr 25, 2016 |
Published | Apr 25, 2016 |
Warriors Trained | 260 |
Total Skips | 2 |
Total Code Submissions | 589 |
Total Times Completed | 104 |
JavaScript Completions | 76 |
Python Completions | 36 |
Total Stars | 2 |
% of votes with a positive feedback rating | 88% of 45 |
Total "Very Satisfied" Votes | 38 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |