5 kyu

Histogram - V1

194 of 995dinglemouse

Description:

Kata in this series

Background

A 6-sided die is rolled a number of times and the results are plotted as a character-based histogram.

Example:

    10
    #
    #
7   #
#   #
#   #     5
#   #     #
# 3 #     #
# # #     #
# # # 1   #
# # # #   #
-----------
1 2 3 4 5 6

Task

You will be passed all the dice roll results, and your task is to write the code to return a string representing a histogram, so that when it is printed it has the same format as the example.

Notes

  • There are no trailing spaces on the lines
  • All lines (including the last) end with a newline \n
  • A count is displayed above each bar (unless the count is 0)
  • The number of rolls may vary but is always less than 100
Strings
Algorithms

Stats:

CreatedAug 31, 2016
PublishedSep 11, 2016
Warriors Trained3298
Total Skips691
Total Code Submissions9962
Total Times Completed995
Java Completions194
C# Completions136
C++ Completions244
JavaScript Completions236
Python Completions204
Go Completions11
Total Stars109
% of votes with a positive feedback rating89% of 253
Total "Very Satisfied" Votes203
Total "Somewhat Satisfied" Votes42
Total "Not Satisfied" Votes8
Total Rank Assessments10
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • dinglemouse Avatar
  • Dentzil Avatar
  • user5036852 Avatar
  • Alex_st Avatar
  • hobovsky Avatar
  • akar-0 Avatar
  • saudiGuy Avatar
Ad