Some swift algorithms to have fun using Playground on Xcode 11
- Xcode 11
- Swift 5
Take in account, some algorithms are not checked in terms of performance.
Please take a look the algorithm, fork, copy, use as you wish, but help me to figure out another way, or another option, for example you will see here algorithms for narrow cases, you can propose a general big one to solve more cases.
- PlaneSeats.playground: Assign passengers seats in an airplane, allocating seats for as many four-person families as possible, from seats between 1A to 1J, assuming a number of 50 rows, taking account reserved and 2 aisles in between. Performance not checked.
- MatrixLayerRotationQuick.playground: You are given a 2D matrix of dimension and a positive integer . You have to rotate the matrix times and print the resultant matrix. Rotation should be in anti-clockwise direction. Good Performance.
- MorganAndString.playground: lexicographically minimal string made of those two collections. Bad Performance.