6 kyu
Computer problem series #7: Indentation mix
Description:
Autoformat code level 2
You have received a code file, it looks like that it has been written by different people with different code editors. There is an unwanted mix of spaces " "
and tabs "\t"
where there should only be spaces.
Task:
The function must correct errors in the indentation of each line of text. Adjust the spaces at the beginning to the closest level of intentation. In the event of a tie, opt for the larger.
One tab "\t"
is equivalent to as many spaces " "
as it takes to reach the next tabstop. Indentation levels must have a multiple of 4 spaces.
Example:
In the examples spaces are represented with "·"
, tabs with \t
·\t# comment
var·int·=·2;
if·(true){
···console.log(int);
··}
·console.log('end');
Should be:
····# comment
var·int·=·2;
if·(true){
····console.log(int);
····}
console.log('end');
Strings
Algorithms
Similar Kata:
Stats:
Created | Oct 23, 2019 |
Published | May 7, 2020 |
Warriors Trained | 268 |
Total Skips | 68 |
Total Code Submissions | 425 |
Total Times Completed | 45 |
Python Completions | 45 |
Total Stars | 3 |
% of votes with a positive feedback rating | 87% of 19 |
Total "Very Satisfied" Votes | 15 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |