This challenge involves parsing a delimited string and applying some logic to perform some calculations based on the position of tokens within the string. This challenge has got a fake (or self?) reference to the TSQL Challenges itself. Your job is to calculate the SQL Stars awarded to each of the winners by parsing a delimited string.
- Sample Data
Challenge Winners ----------------- --------------------------------------------------- TSQL Challenge 25 leszek,lmu92/xaloc,,karinloos,Erick,,,dishdy,jobacr TSQL Challenge 24 ,Dalibor,,lwkwok,,,,lmu92,dishdy TSQL Challenge 23 Mark,Dalibor,Beakdan,,Parth,Ramireddy,lmu92,RubyNote that the data given above is for representational purpose only and it may not match with the actual SQL Stars awarded to the people mentioned in the sample data.
- Expected Results
Winner SQL Stars --------- --------- Dalibor 18 lmu92 16 leszek 10 Mark 10 xaloc 9 Beakdan 8 karinloos 7 lwkwok 7 Erick 6 Parth 6 dishdy 5 Ramireddy 5 Ruby 3 jobacr 2
- Rules
- Each winner gets 1 to 10 SQL Stars. The highest is 10 and lowest is 1.
- The name on the left most position will get 10 SQL Stars and the next gets 9 and so on. In the third row Mark gets 10 SQL Stars and Dalibor gets 9 etc.
- You should process only people who come in the top 10 positions. The input column may have more names, but they should be ignored.
- There may be cases where more than one user is awarded the same number of stars. In such a case, those usernames will be separated by a “/”. In the first example, “lmu92” and “xaloc” are given 9 SQL Stars each.
- It is quite possible that there is no one to claim the SQL Stars at a given position. In the second row, no one claims 10 SQL Stars. Dalibor gets 9 stars, no one to claim 8th position and lwkwok gets 7 SQL Stars etc.
- Output should be ordered by the number of SQL Stars each user gets. People with highest number of SQL Stars should come on top. If more than one user gets the same number of total stars, secondary order should be done by username (case insensitive).