6 kyu

String tops

616 of 1,806dcieslak

Description:

Task

Write a function that accepts msg string and returns local tops of string from the highest to the lowest.
The string's tops are from displaying the string in the below way:

                                                      3
                              p                     2   4
            g               o   q                 1
  b       f   h           n       r             z
a   c   e       i       m          s          y
      d           j   l             t       x
                    k                 u   w
                                        v

The next top is always 1 character higher than the previous one. For the above example, the solution for the abcdefghijklmnopqrstuvwxyz1234 input string is 3pgb.

  • When the msg string is empty, return an empty string.
  • The input strings may be very long. Make sure your solution has good performance.

Check the test cases for more samples.

Fundamentals
Strings

Stats:

CreatedSep 12, 2017
PublishedSep 12, 2017
Warriors Trained3788
Total Skips274
Total Code Submissions6032
Total Times Completed1806
JavaScript Completions616
Python Completions648
C# Completions191
C++ Completions248
Crystal Completions8
Ruby Completions73
Go Completions56
D Completions6
Rust Completions54
RISC-V Completions10
Lua Completions25
Total Stars64
% of votes with a positive feedback rating94% of 404
Total "Very Satisfied" Votes365
Total "Somewhat Satisfied" Votes29
Total "Not Satisfied" Votes10
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • dcieslak Avatar
  • GiacomoSorbi Avatar
  • anter69 Avatar
  • zruF Avatar
  • donaldsebleung Avatar
  • kazk Avatar
  • Souzooka Avatar
  • hobovsky Avatar
  • akar-0 Avatar
  • sid114 Avatar
  • FandaL Avatar
Ad