7 kyu

Print count and numbers

126 of 750nakulgupta18

Description:

Given a string of integers, count how many times that integer repeats itself, then return a string showing the count and the integer.

Example: countMe('1123') (count_me in Ruby)

  • Here 1 comes twice so <count><integer> will be "21"
  • then 2 comes once so <count><integer> will be "12"
  • then 3 comes once so <count><integer> will be "13"

hence output string will be "211213".

Similarly countMe('211213') will return '1221121113' (1 time 2, 2 times 1, 1 time 2, 1 time 1, 1 time 3)

Return "" for empty, nil or non numeric strings

Fundamentals

Stats:

CreatedJul 6, 2015
PublishedJul 6, 2015
Warriors Trained1752
Total Skips61
Total Code Submissions3283
Total Times Completed750
Ruby Completions126
Python Completions306
JavaScript Completions279
C# Completions89
Total Stars27
% of votes with a positive feedback rating92% of 216
Total "Very Satisfied" Votes188
Total "Somewhat Satisfied" Votes22
Total "Not Satisfied" Votes6
Ad
Contributors
  • nakulgupta18 Avatar
  • omegahm Avatar
  • GiacomoSorbi Avatar
  • smile67 Avatar
  • Souzooka Avatar
  • saudiGuy Avatar
Ad