Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding challenge - CodeWars - Snail Sort

Source of the challenge: https://www.codewars.com/kata/521c2db8ddc89b9b7a0000c1

Challenge description

Given an n x n array, return the array elements arranged from outermost elements to the middle element, traveling clockwise.

array = [[1,2,3],
         [4,5,6],
         [7,8,9]]
snail(array) #=> [1,2,3,6,9,8,7,4,5]

For better understanding, please follow the numbers of the next array consecutively:

array = [[1,2,3],
         [8,9,4],
         [7,6,5]]
snail(array) #=> [1,2,3,4,5,6,7,8,9]

Basic testcases

There are more testcases in the tests file.

Solution

solution.h

solution.cpp

About

CodeWars challenge: https://www.codewars.com/kata/521c2db8ddc89b9b7a0000c1

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages