7 kyu

Simple string division

343 of 1,073KenKamau

Description:

In this Kata, you will be given a number in form of a string and an integer k and your task is to insert k commas into the string and determine which of the partitions is the largest.

For example:
solve('1234',1) = 234 because ('1','234') or ('12','34') or ('123','4').
solve('1234',2) = 34 because ('1','2','34') or ('1','23','4') or ('12','3','4'). 
solve('1234',3) = 4
solve('2020',1) = 202

More examples in test cases. Good luck!

Please also try Simple remove duplicates

Fundamentals

Stats:

CreatedAug 27, 2018
PublishedAug 27, 2018
Warriors Trained3337
Total Skips102
Total Code Submissions5901
Total Times Completed1073
JavaScript Completions312
Python Completions343
Ruby Completions50
Haskell Completions37
Go Completions111
C++ Completions95
C# Completions66
Java Completions131
Total Stars59
% of votes with a positive feedback rating90% of 261
Total "Very Satisfied" Votes219
Total "Somewhat Satisfied" Votes31
Total "Not Satisfied" Votes11
Total Rank Assessments7
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • KenKamau Avatar
  • myjinxin2015 Avatar
  • hobovsky Avatar
  • saudiGuy Avatar
Ad