7 kyu
Odd-Even String Sort
4,045 of 19,014Joz
Description:
Given a string s
, your task is to return another string such that even-indexed and odd-indexed characters of s
are grouped and the groups are space-separated. Even-indexed group comes as first, followed by a space, and then by the odd-indexed part.
Examples
input: "CodeWars" => "CdWr oeas"
|||||||| |||| ||||
indices: 01234567 0246 1357
Even indices 0, 2, 4, 6, so we have "CdWr"
as the first group.
Odd indices are 1, 3, 5, 7, so the second group is "oeas"
.
And the final string to return is "Cdwr oeas"
.
Notes
Tested strings are at least 8 characters long.
Strings
Fundamentals
Sorting
Similar Kata:
Stats:
Created | Oct 19, 2016 |
Published | Oct 19, 2016 |
Warriors Trained | 23600 |
Total Skips | 776 |
Total Code Submissions | 38257 |
Total Times Completed | 19014 |
Python Completions | 4045 |
JavaScript Completions | 10821 |
Ruby Completions | 309 |
TypeScript Completions | 422 |
C# Completions | 605 |
C++ Completions | 1018 |
C Completions | 214 |
Java Completions | 1454 |
Haskell Completions | 118 |
NASM Completions | 17 |
Lua Completions | 65 |
Factor Completions | 12 |
Haxe Completions | 9 |
Rust Completions | 110 |
Go Completions | 307 |
D Completions | 3 |
Groovy Completions | 17 |
Total Stars | 143 |
% of votes with a positive feedback rating | 94% of 1817 |
Total "Very Satisfied" Votes | 1614 |
Total "Somewhat Satisfied" Votes | 180 |
Total "Not Satisfied" Votes | 23 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |