├── .appends └── .github │ └── labels.yml ├── .github ├── CODEOWNERS ├── dependabot.yml ├── labels.yml └── workflows │ ├── ci.yml │ ├── configlet.yml │ ├── no-important-files-changed.yml │ ├── ping-cross-track-maintainers-team.yml │ └── sync-labels.yml ├── .gitignore ├── .swiftlint.yml ├── CODE_OF_CONDUCT.md ├── Dangerfile ├── LICENSE ├── Package.swift ├── README.md ├── bin ├── fetch-configlet ├── test_generator.sh └── update-lang-version.sh ├── concepts ├── arrays │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── basics │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── booleans │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── capturing │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── characters-and-strings │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── classes │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── closures │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── conditionals-guard │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── conditionals-switch │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── conditionals │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── control-transfer │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── default-parameters │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── dictionaries │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── enumerations │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── escaping-functions │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── for-loops │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── function-overloading │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── higher-order-functions │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── importing │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── initializers │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── inout-parameters │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── loops │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── methods │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── multiple-return-values │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── nested-functions │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── numbers │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── opaque-indices │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── optionals │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── ranges │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── repeat-while │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── self │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── shorthand-arguments │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── stored-properties │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── string-indexing │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── string-methods │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── strings │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── structs-and-classes │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── structs │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── ternary-operator │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── trailing-closures │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── tuples │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── value-and-reference-types │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── variadic-parameters │ ├── .meta │ │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json └── while-and-repeat-loops │ ├── .meta │ └── config.json │ ├── about.md │ ├── introduction.md │ └── links.json ├── config.json ├── docs ├── ABOUT.md ├── INSTALLATION.md ├── LEARNING.md ├── RESOURCES.md ├── SNIPPET.txt ├── TESTS.md └── config.json ├── exercises ├── concept │ ├── bird-watcher │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── BirdWatcher │ │ │ │ │ └── BirdWatcherExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── BirdWatcher │ │ │ │ └── BirdWatcher.swift │ │ └── Tests │ │ │ └── BirdWatcherTests │ │ │ └── BirdWatcherTests.swift │ ├── bomb-defuser │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── BombDefuser │ │ │ │ │ └── BombDefuserExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── BombDefuser │ │ │ │ └── BombDefuser.swift │ │ └── Tests │ │ │ └── BombDefuserTests │ │ │ └── BombDefuserTests.swift │ ├── chessboard │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Chessboard │ │ │ │ │ └── ChessboardExemplar.swift │ │ │ └── config.json │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Chessboard │ │ │ │ └── Chessboard.swift │ │ └── Tests │ │ │ └── ChessboardTests │ │ │ └── ChessboardTests.swift │ ├── custom-signs │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── CustomSigns │ │ │ │ │ └── CustomSignsExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── CustomSigns │ │ │ │ └── CustomSigns.swift │ │ └── Tests │ │ │ └── CustomSignsTests │ │ │ └── CustomSignsTests.swift │ ├── expert-mixologist │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ExpertMixologist │ │ │ │ │ └── ExpertMixologistExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ExpertMixologist │ │ │ │ └── ExpertMixologist.swift │ │ └── Tests │ │ │ └── ExpertMixologistTests │ │ │ └── ExpertMixologistTests.swift │ ├── freelancer-rates │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── FreelancerRates │ │ │ │ │ └── FreelancerRatesExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── FreelancerRates │ │ │ │ └── FreelancerRates.swift │ │ └── Tests │ │ │ └── FreelancerRatesTests │ │ │ └── FreelancerRatesTests.swift │ ├── high-score-board │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── HighScoreBoard │ │ │ │ │ └── HighScoreBoardExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── HighScoreBoard │ │ │ │ └── HighScoreBoard.swift │ │ └── Tests │ │ │ └── HighScoreBoardTests │ │ │ └── HighScoreBoardTests.swift │ ├── lasagna-master │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── LasagnaMaster │ │ │ │ │ └── LasagnaMasterExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── LasagnaMaster │ │ │ │ └── LasagnaMaster.swift │ │ └── Tests │ │ │ └── LasagnaMasterTests │ │ │ └── LasagnaMasterTests.swift │ ├── lasagna │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Lasagna │ │ │ │ │ └── LasagnaExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Lasagna │ │ │ │ └── Lasagna.swift │ │ └── Tests │ │ │ └── LasagnaTests │ │ │ └── LasagnaTests.swift │ ├── log-lines │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── LogLines │ │ │ │ │ └── LogLinesExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── LogLines │ │ │ │ └── LogLines.swift │ │ └── Tests │ │ │ └── LogLinesTests │ │ │ └── LogLinesTests.swift │ ├── magician-in-training │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── MagicianInTraining │ │ │ │ │ └── MagicianInTrainingExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── MagicianInTraining │ │ │ │ └── MagicianInTraining.swift │ │ └── Tests │ │ │ └── MagicianInTrainingTests │ │ │ └── MagicianInTrainingTests.swift │ ├── pizza-slices │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PizzaSlices │ │ │ │ │ └── PizzaSlicesExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PizzaSlices │ │ │ │ └── PizzaSlices.swift │ │ └── Tests │ │ │ └── PizzaSlicesTests │ │ │ └── PizzaSlicesTests.swift │ ├── poetry-club │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PoetryClub │ │ │ │ │ └── PoetryClubExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PoetryClub │ │ │ │ └── PoetryClub.swift │ │ └── Tests │ │ │ └── PoetryClubTests │ │ │ └── PoetryClubTests.swift │ ├── santas-helper │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SantasHelper │ │ │ │ │ └── SantasHelperExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SantasHelper │ │ │ │ └── SantasHelper.swift │ │ └── Tests │ │ │ └── SantasHelperTests │ │ │ └── SantasHelperTests.swift │ ├── secret-agent │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SecretAgent │ │ │ │ │ └── SecretAgentExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SecretAgent │ │ │ │ └── SecretAgent.swift │ │ └── Tests │ │ │ └── SecretAgentTests │ │ │ └── SecretAgentTests.swift │ ├── vehicle-purchase │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── VehiclePurchase │ │ │ │ │ └── VehiclePurchaseExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── VehiclePurchase │ │ │ │ └── VehiclePurchase.swift │ │ └── Tests │ │ │ └── VehiclePurchaseTests │ │ │ └── VehiclePurchaseTests.swift │ ├── windowing-system │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── WindowingSystem │ │ │ │ │ └── WindowingSystemExemplar.swift │ │ │ ├── config.json │ │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── WindowingSystem │ │ │ │ └── WindowingSystem.swift │ │ └── Tests │ │ │ └── WindowingSystemTests │ │ │ └── WindowingSystemTests.swift │ └── wings-quest │ │ ├── .docs │ │ ├── hints.md │ │ ├── instructions.md │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ ├── Sources │ │ │ └── WingsQuest │ │ │ │ └── WingsQuestExemplar.swift │ │ ├── config.json │ │ └── design.md │ │ ├── Package.swift │ │ ├── Sources │ │ └── WingsQuest │ │ │ └── WingsQuest.swift │ │ └── Tests │ │ └── WingsQuestTests │ │ └── WingsQuestTests.swift ├── practice │ ├── accumulate │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Accumulate │ │ │ │ │ └── AccumulateExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Accumulate │ │ │ │ └── Accumulate.swift │ │ └── Tests │ │ │ └── AccumulateTests │ │ │ └── AccumulateTests.swift │ ├── acronym │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Acronym │ │ │ │ │ └── AcronymExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Acronym │ │ │ │ └── Acronym.swift │ │ └── Tests │ │ │ └── AcronymTests │ │ │ └── AcronymTests.swift │ ├── all-your-base │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── AllYourBase │ │ │ │ │ └── AllYourBaseExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── AllYourBase │ │ │ │ └── AllYourBase.swift │ │ └── Tests │ │ │ └── AllYourBaseTests │ │ │ └── AllYourBaseTests.swift │ ├── allergies │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Allergies │ │ │ │ │ └── AllergiesExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Allergies │ │ │ │ └── Allergies.swift │ │ └── Tests │ │ │ └── AllergiesTests │ │ │ └── AllergiesTests.swift │ ├── anagram │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Anagram │ │ │ │ │ └── AnagramExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Anagram │ │ │ │ └── Anagram.swift │ │ └── Tests │ │ │ └── AnagramTests │ │ │ └── AnagramTests.swift │ ├── armstrong-numbers │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ArmstrongNumbers │ │ │ │ │ └── ArmstrongNumbersExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ArmstrongNumbers │ │ │ │ └── ArmstrongNumbers.swift │ │ └── Tests │ │ │ └── ArmstrongNumbersTests │ │ │ └── ArmstrongNumbersTests.swift │ ├── atbash-cipher │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── AtbashCipher │ │ │ │ │ └── AtbashCipherExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── AtbashCipher │ │ │ │ └── AtbashCipher.swift │ │ └── Tests │ │ │ └── AtbashCipherTests │ │ │ └── AtbashCipherTests.swift │ ├── beer-song │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── BeerSong │ │ │ │ │ └── BeerSongExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── BeerSong │ │ │ │ └── BeerSong.swift │ │ └── Tests │ │ │ └── BeerSongTests │ │ │ └── BeerSongTests.swift │ ├── binary-search-tree │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── BinarySearchTree │ │ │ │ │ └── BinarySearchTreeExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── BinarySearchTree │ │ │ │ └── BinarySearchTree.swift │ │ └── Tests │ │ │ └── BinarySearchTreeTests │ │ │ └── BinarySearchTreeTests.swift │ ├── binary-search │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── BinarySearch │ │ │ │ │ └── BinarySearchExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── BinarySearch │ │ │ │ └── BinarySearch.swift │ │ └── Tests │ │ │ └── BinarySearchTests │ │ │ └── BinarySearchTests.swift │ ├── binary │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Binary │ │ │ │ │ └── BinaryExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Binary │ │ │ │ └── Binary.swift │ │ └── Tests │ │ │ └── BinaryTests │ │ │ └── BinaryTests.swift │ ├── bob │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Bob │ │ │ │ │ └── BobExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Bob │ │ │ │ └── Bob.swift │ │ └── Tests │ │ │ └── BobTests │ │ │ └── BobTests.swift │ ├── bottle-song │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── BottleSong │ │ │ │ │ └── BottleSongExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── BottleSong │ │ │ │ └── BottleSong.swift │ │ └── Tests │ │ │ └── BottleSongTests │ │ │ └── BottleSongTests.swift │ ├── bowling │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Bowling │ │ │ │ │ └── BowlingExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Bowling │ │ │ │ └── Bowling.swift │ │ └── Tests │ │ │ └── BowlingTests │ │ │ └── BowlingTests.swift │ ├── circular-buffer │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── CircularBuffer │ │ │ │ │ └── CircularBufferExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── CircularBuffer │ │ │ │ └── CircularBuffer.swift │ │ └── Tests │ │ │ └── CircularBufferTests │ │ │ └── CircularBufferTests.swift │ ├── clock │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Clock │ │ │ │ │ └── ClockExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Clock │ │ │ │ └── Clock.swift │ │ └── Tests │ │ │ └── ClockTests │ │ │ └── ClockTests.swift │ ├── collatz-conjecture │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── CollatzConjecture │ │ │ │ │ └── CollatzConjectureExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── CollatzConjecture │ │ │ │ └── CollatzConjecture.swift │ │ └── Tests │ │ │ └── CollatzConjectureTests │ │ │ └── CollatzConjectureTests.swift │ ├── complex-numbers │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ComplexNumbers │ │ │ │ │ └── ComplexNumbersExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ComplexNumbers │ │ │ │ └── ComplexNumbers.swift │ │ └── Tests │ │ │ └── ComplexNumbersTests │ │ │ └── ComplexNumbersTests.swift │ ├── crypto-square │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── CryptoSquare │ │ │ │ │ └── CryptoSquareExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── CryptoSquare │ │ │ │ └── CryptoSquare.swift │ │ └── Tests │ │ │ └── CryptoSquareTests │ │ │ └── CryptoSquareTests.swift │ ├── custom-set │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── CustomSet │ │ │ │ │ └── CustomSetExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── CustomSet │ │ │ │ └── CustomSet.swift │ │ └── Tests │ │ │ └── CustomSetTests │ │ │ └── CustomSetTests.swift │ ├── darts │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Darts │ │ │ │ │ └── DartsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Darts │ │ │ │ └── Darts.swift │ │ └── Tests │ │ │ └── DartsTests │ │ │ └── DartsTests.swift │ ├── diamond │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Diamond │ │ │ │ │ └── DiamondExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Diamond │ │ │ │ └── Diamond.swift │ │ └── Tests │ │ │ └── DiamondTests │ │ │ └── DiamondTests.swift │ ├── difference-of-squares │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── DifferenceOfSquares │ │ │ │ │ └── DifferenceOfSquaresExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── DifferenceOfSquares │ │ │ │ └── DifferenceOfSquares.swift │ │ └── Tests │ │ │ └── DifferenceOfSquaresTests │ │ │ └── DifferenceOfSquaresTests.swift │ ├── dominoes │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Dominoes │ │ │ │ │ └── DominoesExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Dominoes │ │ │ │ └── Dominoes.swift │ │ └── Tests │ │ │ └── DominoesTests │ │ │ └── DominoesTests.swift │ ├── etl │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Etl │ │ │ │ │ └── EtlExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Etl │ │ │ │ └── Etl.swift │ │ └── Tests │ │ │ └── EtlTests │ │ │ └── EtlTests.swift │ ├── flatten-array │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── FlattenArray │ │ │ │ │ └── FlattenArrayExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── FlattenArray │ │ │ │ └── FlattenArray.swift │ │ └── Tests │ │ │ └── FlattenArrayTests │ │ │ └── FlattenArrayTests.swift │ ├── food-chain │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── FoodChain │ │ │ │ │ └── FoodChainExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── FoodChain │ │ │ │ └── FoodChain.swift │ │ └── Tests │ │ │ └── FoodChainTests │ │ │ └── FoodChainTests.swift │ ├── gigasecond │ │ ├── .docs │ │ │ ├── hints.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Gigasecond │ │ │ │ │ └── GigasecondExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Gigasecond │ │ │ │ └── Gigasecond.swift │ │ └── Tests │ │ │ └── GigasecondTests │ │ │ └── GigasecondTests.swift │ ├── grade-school │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── GradeSchool │ │ │ │ │ └── GradeSchoolExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── GradeSchool │ │ │ │ └── GradeSchool.swift │ │ └── Tests │ │ │ └── GradeSchoolTests │ │ │ └── GradeSchoolTests.swift │ ├── grains │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Grains │ │ │ │ │ └── GrainsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Grains │ │ │ │ └── Grains.swift │ │ └── Tests │ │ │ └── GrainsTests │ │ │ └── GrainsTests.swift │ ├── hamming │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Hamming │ │ │ │ │ └── HammingExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Hamming │ │ │ │ └── Hamming.swift │ │ └── Tests │ │ │ └── HammingTests │ │ │ └── HammingTests.swift │ ├── hello-world │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── HelloWorld │ │ │ │ │ └── HelloWorldExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── HelloWorld │ │ │ │ └── HelloWorld.swift │ │ └── Tests │ │ │ └── HelloWorldTests │ │ │ └── HelloWorldTests.swift │ ├── hexadecimal │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Hexadecimal │ │ │ │ │ └── HexadecimalExample.swift │ │ │ └── config.json │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Hexadecimal │ │ │ │ └── Hexadecimal.swift │ │ └── Tests │ │ │ └── HexadecimalTests │ │ │ └── HexadecimalTests.swift │ ├── house │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── House │ │ │ │ │ └── HouseExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── House │ │ │ │ └── House.swift │ │ └── Tests │ │ │ └── HouseTests │ │ │ └── HouseTests.swift │ ├── isbn-verifier │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── IsbnVerifier │ │ │ │ │ └── IsbnVerifierExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── IsbnVerifier │ │ │ │ └── IsbnVerifier.swift │ │ └── Tests │ │ │ └── IsbnVerifierTests │ │ │ └── IsbnVerifierTests.swift │ ├── isogram │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Isogram │ │ │ │ │ └── IsogramExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Isogram │ │ │ │ └── Isogram.swift │ │ └── Tests │ │ │ └── IsogramTests │ │ │ └── IsogramTests.swift │ ├── kindergarten-garden │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── KindergartenGarden │ │ │ │ │ └── KindergartenGardenExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── KindergartenGarden │ │ │ │ └── KindergartenGarden.swift │ │ └── Tests │ │ │ └── KindergartenGardenTests │ │ │ └── KindergartenGardenTests.swift │ ├── knapsack │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Knapsack │ │ │ │ │ ├── Item.swift │ │ │ │ │ └── KnapsackExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Knapsack │ │ │ │ ├── Item.swift │ │ │ │ └── Knapsack.swift │ │ └── Tests │ │ │ └── KnapsackTests │ │ │ └── KnapsackTests.swift │ ├── largest-series-product │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── LargestSeriesProduct │ │ │ │ │ └── LargestSeriesProductExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── LargestSeriesProduct │ │ │ │ └── LargestSeriesProduct.swift │ │ └── Tests │ │ │ └── LargestSeriesProductTests │ │ │ └── LargestSeriesProductTests.swift │ ├── leap │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Leap │ │ │ │ │ └── LeapExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Leap │ │ │ │ └── Leap.swift │ │ └── Tests │ │ │ └── LeapTests │ │ │ └── LeapTests.swift │ ├── linked-list │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── LinkedList │ │ │ │ │ └── LinkedListExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── LinkedList │ │ │ │ └── LinkedList.swift │ │ └── Tests │ │ │ └── LinkedListTests │ │ │ └── LinkedListTests.swift │ ├── list-ops │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ListOps │ │ │ │ │ └── ListOpsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ListOps │ │ │ │ └── ListOps.swift │ │ └── Tests │ │ │ └── ListOpsTests │ │ │ └── ListOpsTests.swift │ ├── luhn │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Luhn │ │ │ │ │ └── LuhnExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Luhn │ │ │ │ └── Luhn.swift │ │ └── Tests │ │ │ └── LuhnTests │ │ │ └── LuhnTests.swift │ ├── matching-brackets │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── MatchingBrackets │ │ │ │ │ └── MatchingBracketsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── MatchingBrackets │ │ │ │ └── MatchingBrackets.swift │ │ └── Tests │ │ │ └── MatchingBracketsTests │ │ │ └── MatchingBracketsTests.swift │ ├── matrix │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Matrix │ │ │ │ │ └── MatrixExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Matrix │ │ │ │ └── Matrix.swift │ │ └── Tests │ │ │ └── MatrixTests │ │ │ └── MatrixTests.swift │ ├── meetup │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Meetup │ │ │ │ │ └── MeetupExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Meetup │ │ │ │ └── Meetup.swift │ │ └── Tests │ │ │ └── MeetupTests │ │ │ └── MeetupTests.swift │ ├── minesweeper │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Minesweeper │ │ │ │ │ └── MinesweeperExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Minesweeper │ │ │ │ └── Minesweeper.swift │ │ └── Tests │ │ │ └── MinesweeperTests │ │ │ └── MinesweeperTests.swift │ ├── nth-prime │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── NthPrime │ │ │ │ │ └── NthPrimeExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── NthPrime │ │ │ │ └── NthPrime.swift │ │ └── Tests │ │ │ └── NthPrimeTests │ │ │ └── NthPrimeTests.swift │ ├── nucleotide-count │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── NucleotideCount │ │ │ │ │ └── NucleotideCountExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── NucleotideCount │ │ │ │ └── NucleotideCount.swift │ │ └── Tests │ │ │ └── NucleotideCountTests │ │ │ └── NucleotideCountTests.swift │ ├── ocr-numbers │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── OcrNumbers │ │ │ │ │ └── OcrNumbersExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── OcrNumbers │ │ │ │ └── OcrNumbers.swift │ │ └── Tests │ │ │ └── OcrNumbersTests │ │ │ └── OcrNumbersTests.swift │ ├── octal │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Octal │ │ │ │ │ └── OctalExample.swift │ │ │ └── config.json │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Octal │ │ │ │ └── Octal.swift │ │ └── Tests │ │ │ └── OctalTests │ │ │ └── OctalTests.swift │ ├── palindrome-products │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PalindromeProducts │ │ │ │ │ └── PalindromeProductsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PalindromeProducts │ │ │ │ └── PalindromeProducts.swift │ │ └── Tests │ │ │ └── PalindromeProductsTests │ │ │ └── PalindromeProductsTests.swift │ ├── pangram │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Pangram │ │ │ │ │ └── PangramExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Pangram │ │ │ │ └── Pangram.swift │ │ └── Tests │ │ │ └── PangramTests │ │ │ └── PangramTests.swift │ ├── pascals-triangle │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PascalsTriangle │ │ │ │ │ └── PascalsTriangleExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PascalsTriangle │ │ │ │ └── PascalsTriangle.swift │ │ └── Tests │ │ │ └── PascalsTriangleTests │ │ │ └── PascalsTriangleTests.swift │ ├── perfect-numbers │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PerfectNumbers │ │ │ │ │ └── PerfectNumbersExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PerfectNumbers │ │ │ │ └── PerfectNumbers.swift │ │ └── Tests │ │ │ └── PerfectNumbersTests │ │ │ └── PerfectNumbersTests.swift │ ├── phone-number │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PhoneNumber │ │ │ │ │ └── PhoneNumberExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PhoneNumber │ │ │ │ └── PhoneNumber.swift │ │ └── Tests │ │ │ └── PhoneNumberTests │ │ │ └── PhoneNumberTests.swift │ ├── pig-latin │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PigLatin │ │ │ │ │ └── PigLatinExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PigLatin │ │ │ │ └── PigLatin.swift │ │ └── Tests │ │ │ └── PigLatinTests │ │ │ └── PigLatinTests.swift │ ├── poker │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Poker │ │ │ │ │ └── PokerExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Poker │ │ │ │ └── Poker.swift │ │ └── Tests │ │ │ └── PokerTests │ │ │ └── PokerTests.swift │ ├── prime-factors │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PrimeFactors │ │ │ │ │ └── PrimeFactorsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PrimeFactors │ │ │ │ └── PrimeFactors.swift │ │ └── Tests │ │ │ └── PrimeFactorsTests │ │ │ └── PrimeFactorsTests.swift │ ├── protein-translation │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ProteinTranslation │ │ │ │ │ └── ProteinTranslationExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ProteinTranslation │ │ │ │ └── ProteinTranslation.swift │ │ └── Tests │ │ │ └── ProteinTranslationTests │ │ │ └── ProteinTranslationTests.swift │ ├── proverb │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Proverb │ │ │ │ │ └── ProverbExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Proverb │ │ │ │ └── Proverb.swift │ │ └── Tests │ │ │ └── ProverbTests │ │ │ └── ProverbTests.swift │ ├── pythagorean-triplet │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── PythagoreanTriplet │ │ │ │ │ └── PythagoreanTripletExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── PythagoreanTriplet │ │ │ │ └── PythagoreanTriplet.swift │ │ └── Tests │ │ │ └── PythagoreanTripletTests │ │ │ └── PythagoreanTripletTests.swift │ ├── queen-attack │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── QueenAttack │ │ │ │ │ └── QueenAttackExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── QueenAttack │ │ │ │ └── QueenAttack.swift │ │ └── Tests │ │ │ └── QueenAttackTests │ │ │ └── QueenAttackTests.swift │ ├── raindrops │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Raindrops │ │ │ │ │ └── RaindropsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Raindrops │ │ │ │ └── Raindrops.swift │ │ └── Tests │ │ │ └── RaindropsTests │ │ │ └── RaindropsTests.swift │ ├── reverse-string │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ReverseString │ │ │ │ │ └── ReverseStringExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ReverseString │ │ │ │ └── ReverseString.swift │ │ └── Tests │ │ │ └── ReverseStringTests │ │ │ └── ReverseStringTests.swift │ ├── rna-transcription │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── RnaTranscription │ │ │ │ │ └── RnaTranscriptionExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── RnaTranscription │ │ │ │ └── RnaTranscription.swift │ │ └── Tests │ │ │ └── RnaTranscriptionTests │ │ │ └── RnaTranscriptionTests.swift │ ├── robot-name │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── RobotName │ │ │ │ │ └── RobotNameExample.swift │ │ │ └── config.json │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── RobotName │ │ │ │ └── RobotName.swift │ │ └── Tests │ │ │ └── RobotNameTests │ │ │ └── RobotNameTests.swift │ ├── robot-simulator │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── RobotSimulator │ │ │ │ │ └── RobotSimulatorExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── RobotSimulator │ │ │ │ └── RobotSimulator.swift │ │ └── Tests │ │ │ └── RobotSimulatorTests │ │ │ └── RobotSimulatorTests.swift │ ├── roman-numerals │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── RomanNumerals │ │ │ │ │ └── RomanNumeralsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── RomanNumerals │ │ │ │ └── RomanNumerals.swift │ │ └── Tests │ │ │ └── RomanNumeralsTests │ │ │ └── RomanNumeralsTests.swift │ ├── rotational-cipher │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── RotationalCipher │ │ │ │ │ └── RotationalCipherExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── RotationalCipher │ │ │ │ └── RotationalCipher.swift │ │ └── Tests │ │ │ └── RotationalCipherTests │ │ │ └── RotationalCipherTests.swift │ ├── run-length-encoding │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── RunLengthEncoding │ │ │ │ │ └── RunLengthEncodingExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── RunLengthEncoding │ │ │ │ └── RunLengthEncoding.swift │ │ └── Tests │ │ │ └── RunLengthEncodingTests │ │ │ └── RunLengthEncodingTests.swift │ ├── saddle-points │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SaddlePoints │ │ │ │ │ ├── Position.swift │ │ │ │ │ └── SaddlePointsExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SaddlePoints │ │ │ │ ├── Position.swift │ │ │ │ └── SaddlePoints.swift │ │ └── Tests │ │ │ └── SaddlePointsTests │ │ │ └── SaddlePointsTests.swift │ ├── say │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Say │ │ │ │ │ └── SayExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Say │ │ │ │ └── Say.swift │ │ └── Tests │ │ │ └── SayTests │ │ │ └── SayTests.swift │ ├── scale-generator │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ScaleGenerator │ │ │ │ │ └── ScaleGeneratorExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ScaleGenerator │ │ │ │ └── ScaleGenerator.swift │ │ └── Tests │ │ │ └── ScaleGeneratorTests │ │ │ └── ScaleGeneratorTests.swift │ ├── scrabble-score │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── ScrabbleScore │ │ │ │ │ └── ScrabbleScoreExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── ScrabbleScore │ │ │ │ └── ScrabbleScore.swift │ │ └── Tests │ │ │ └── ScrabbleScoreTests │ │ │ └── ScrabbleScoreTests.swift │ ├── secret-handshake │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SecretHandshake │ │ │ │ │ └── SecretHandshakeExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SecretHandshake │ │ │ │ └── SecretHandshake.swift │ │ └── Tests │ │ │ └── SecretHandshakeTests │ │ │ └── SecretHandshakeTests.swift │ ├── series │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Series │ │ │ │ │ └── SeriesExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Series │ │ │ │ └── Series.swift │ │ └── Tests │ │ │ └── SeriesTests │ │ │ └── SeriesTests.swift │ ├── sieve │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Sieve │ │ │ │ │ └── SieveExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Sieve │ │ │ │ └── Sieve.swift │ │ └── Tests │ │ │ └── SieveTests │ │ │ └── SieveTests.swift │ ├── simple-cipher │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SimpleCipher │ │ │ │ │ └── SimpleCipherExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SimpleCipher │ │ │ │ └── SimpleCipher.swift │ │ └── Tests │ │ │ └── SimpleCipherTests │ │ │ └── SimpleCipherTests.swift │ ├── simple-linked-list │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SimpleLinkedList │ │ │ │ │ └── SimpleLinkedListExample.swift │ │ │ └── config.json │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SimpleLinkedList │ │ │ │ └── SimpleLinkedList.swift │ │ └── Tests │ │ │ └── SimpleLinkedListTests │ │ │ └── SimpleLinkedListTests.swift │ ├── space-age │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SpaceAge │ │ │ │ │ └── SpaceAgeExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SpaceAge │ │ │ │ └── SpaceAge.swift │ │ └── Tests │ │ │ └── SpaceAgeTests │ │ │ └── SpaceAgeTests.swift │ ├── strain │ │ ├── .docs │ │ │ ├── instructions.append.md │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Strain │ │ │ │ │ └── StrainExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Strain │ │ │ │ └── Strain.swift │ │ └── Tests │ │ │ └── StrainTests │ │ │ └── StrainTests.swift │ ├── sublist │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Sublist │ │ │ │ │ └── SublistExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Sublist │ │ │ │ └── Sublist.swift │ │ └── Tests │ │ │ └── SublistTests │ │ │ └── SublistTests.swift │ ├── sum-of-multiples │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── SumOfMultiples │ │ │ │ │ └── SumOfMultiplesExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── SumOfMultiples │ │ │ │ └── SumOfMultiples.swift │ │ └── Tests │ │ │ └── SumOfMultiplesTests │ │ │ └── SumOfMultiplesTests.swift │ ├── tournament │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Tournament │ │ │ │ │ └── TournamentExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Tournament │ │ │ │ └── Tournament.swift │ │ └── Tests │ │ │ └── TournamentTests │ │ │ └── TournamentTests.swift │ ├── transpose │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Transpose │ │ │ │ │ └── TransposeExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Transpose │ │ │ │ └── Transpose.swift │ │ └── Tests │ │ │ └── TransposeTests │ │ │ └── TransposeTests.swift │ ├── triangle │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Triangle │ │ │ │ │ └── TriangleExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Triangle │ │ │ │ └── Triangle.swift │ │ └── Tests │ │ │ └── TriangleTests │ │ │ └── TriangleTests.swift │ ├── trinary │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── Trinary │ │ │ │ │ └── TrinaryExample.swift │ │ │ ├── config.json │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── Trinary │ │ │ │ └── Trinary.swift │ │ └── Tests │ │ │ └── TrinaryTests │ │ │ └── TrinaryTests.swift │ ├── twelve-days │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── TwelveDays │ │ │ │ │ └── TwelveDaysExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── TwelveDays │ │ │ │ └── TwelveDays.swift │ │ └── Tests │ │ │ └── TwelveDaysTests │ │ │ └── TwelveDaysTests.swift │ ├── two-fer │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── TwoFer │ │ │ │ │ └── TwoFerExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── TwoFer │ │ │ │ └── TwoFer.swift │ │ └── Tests │ │ │ └── TwoFerTests │ │ │ └── TwoFerTests.swift │ ├── word-count │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ ├── .gitignore │ │ ├── .meta │ │ │ ├── Sources │ │ │ │ └── WordCount │ │ │ │ │ └── WordCountExample.swift │ │ │ ├── config.json │ │ │ ├── template.swift │ │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ │ └── WordCount │ │ │ │ └── WordCount.swift │ │ └── Tests │ │ │ └── WordCountTests │ │ │ └── WordCountTests.swift │ └── wordy │ │ ├── .docs │ │ └── instructions.md │ │ ├── .gitignore │ │ ├── .meta │ │ ├── Sources │ │ │ └── Wordy │ │ │ │ └── WordyExample.swift │ │ ├── config.json │ │ ├── template.swift │ │ └── tests.toml │ │ ├── Package.swift │ │ ├── Sources │ │ └── Wordy │ │ │ └── Wordy.swift │ │ └── Tests │ │ └── WordyTests │ │ └── WordyTests.swift └── shared │ └── .docs │ ├── cli.md │ ├── debug.md │ ├── help.md │ └── tests.md ├── generator ├── Package.swift ├── Sources │ └── Generator │ │ ├── generator-help.swift │ │ ├── generator-plugins.swift │ │ └── main.swift ├── Tests │ └── GeneratorTests │ │ ├── GeneratorTests.swift │ │ └── files │ │ ├── all-test-removed │ │ └── .meta │ │ │ └── tests.toml │ │ ├── all-tests-included │ │ └── .meta │ │ │ └── tests.toml │ │ └── two-tests-removed │ │ └── .meta │ │ └── tests.toml └── readme.md └── reference ├── implementing-a-concept-exercise.md └── progression.md /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners 2 | .github/CODEOWNERS @exercism/maintainers-admin 3 | 4 | # Changes to `fetch-configlet` should be made in the `exercism/configlet` repo 5 | bin/fetch-configlet @exercism/maintainers-admin 6 | 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | 5 | # Keep dependencies for GitHub Actions up-to-date 6 | - package-ecosystem: 'github-actions' 7 | directory: '/' 8 | schedule: 9 | interval: 'monthly' 10 | -------------------------------------------------------------------------------- /.github/workflows/configlet.yml: -------------------------------------------------------------------------------- 1 | name: Configlet 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | configlet: 15 | uses: exercism/github-actions/.github/workflows/configlet.yml@main 16 | with: 17 | fmt: true 18 | -------------------------------------------------------------------------------- /.github/workflows/ping-cross-track-maintainers-team.yml: -------------------------------------------------------------------------------- 1 | name: Ping cross-track maintainers team 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | 8 | permissions: 9 | pull-requests: write 10 | 11 | jobs: 12 | ping: 13 | if: github.repository_owner == 'exercism' # Stops this job from running on forks 14 | uses: exercism/github-actions/.github/workflows/ping-cross-track-maintainers-team.yml@main 15 | secrets: 16 | github_membership_token: ${{ secrets.COMMUNITY_CONTRIBUTIONS_WORKFLOW_TOKEN }} 17 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | name: Tools 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - .github/labels.yml 9 | - .github/workflows/sync-labels.yml 10 | workflow_dispatch: 11 | schedule: 12 | - cron: 0 0 1 * * # First day of each month 13 | 14 | permissions: 15 | issues: write 16 | 17 | jobs: 18 | sync-labels: 19 | uses: exercism/github-actions/.github/workflows/labels.yml@main 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/configlet 2 | bin/configlet.exe 3 | 4 | # Xcode 5 | # 6 | .swiftpm 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | .DS_Store 24 | 25 | #Idea IDE 26 | .idea 27 | 28 | # Swift 29 | .build 30 | LinuxMain.swift 31 | Package.resolved 32 | xswift.xcodeproj/ 33 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | identifier_name: 2 | min_length: 3 | warning: 1 4 | error: 0 5 | 6 | large_tuple: 7 | warning: 5 8 | error: 6 9 | 10 | colon: 11 | apply_to_dictionaries: false 12 | 13 | opt_in_rules: 14 | - vertical_whitespace 15 | - closure_spacing 16 | 17 | disabled_rules: # rule identifiers to exclude from running 18 | - function_body_length 19 | - line_length 20 | - trailing_comma 21 | - force_try 22 | 23 | reporter: "json" 24 | -------------------------------------------------------------------------------- /concepts/arrays/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Arrays are a collection of multiple values of the same type.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [ 8 | "heitara", 9 | "BNAndras" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /concepts/arrays/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://developer.apple.com/documentation/swift/array", 4 | "description": "Apple Swift Documentation: Array" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/collectiontypes/#Arrays", 8 | "description": "The Swift Language Guide: Collection Types" 9 | } 10 | ] -------------------------------------------------------------------------------- /concepts/basics/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Swift is a compiled, multi-paradigm language, that uses static typing.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/booleans/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Booleans are either true or false. They support NOT, AND, and OR operators.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/booleans/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics#Booleans", 4 | "description": "Swift Book: Booleans" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/basicoperators/#Logical-Operators", 8 | "description": "Swift Book: Logical operators" 9 | }, 10 | { 11 | "url": "https://developer.apple.com/documentation/swift/bool", 12 | "description": "Swift docs: Bool" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /concepts/capturing/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Captures allow closures and functions to access the parameters and variables of their surrounding environment.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/capturing/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/Closures.html", 4 | "description": "Swift Language Guide: Closures" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/LanguageGuide/Functions.html", 8 | "description": "Swift Language Guide: Functions" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /concepts/characters-and-strings/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Strings in Swift are a collection of characters, where characters holds a unicode value", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/characters-and-strings/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/stringsandcharacters/", 4 | "description": "Swift Book: Strings and Characters" 5 | }, 6 | { 7 | "url": "https://developer.apple.com/documentation/swift/string", 8 | "description": "Apple Docs: String" 9 | }, 10 | { 11 | "url": "https://developer.apple.com/documentation/swift/character", 12 | "description": "Apple Docs: Character" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /concepts/classes/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Classes provide a way to group together related data and functions into self-contained units of functionality.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/classes/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/closures/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Closures in Swift are self-contained blocks of code that can be passed parameters to trigger their computation and return values.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/closures/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/closures/", 4 | "description": "Swift Book: Closures" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/conditionals-guard/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "The guard statement in Swift is used for early returns from Swift functions when a required condition is not met.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/conditionals-guard/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/conditionals-switch/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "A switch is a selection statement that executes a single case from a list of cases based on a pattern match.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [ 7 | "meatball133" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /concepts/conditionals-switch/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/controlflow/#Switch", 4 | "description": "Swift Book: Switch" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/conditionals/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Conditionals are a way to make decisions in your code. They allow you to run code only when certain conditions are met.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/conditionals/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/controlflow#If", 4 | "description": "Swift Book: If" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/basicoperators#Comparison-Operators", 8 | "description": "Swift Book: Comparison Operators" 9 | }, 10 | { 11 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/statements#If-Statement", 12 | "description": "Swift References: If Statements" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /concepts/control-transfer/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Control transfer allows modifiying the control flow inside loops.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/control-transfer/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/controlflow/#Control-Transfer-Statements", 4 | "description": "Swift Book: Control Transfer Statements" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/default-parameters/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Default parameter values can be used to give a parameter a default value, which means that the caller doesn't need to provide a value for that parameter.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/default-parameters/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/functions/#Default-Parameter-Values", 4 | "description": "Swift.org: Default Parameter Values" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/dictionaries/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Dictionaries are a collection type that provided a mappings between keys and values.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/dictionaries/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/collectiontypes/#Dictionaries", 4 | "description": "Swift Book: Dictionaries" 5 | }, 6 | { 7 | "url": "https://developer.apple.com/documentation/swift/dictionary", 8 | "description": "Swift docs: Dictionary" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /concepts/enumerations/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Enumerations allow for a declarative way of associating a fixed set of constant name/value pairs.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/enumerations/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/escaping-functions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "When a higher-order function takes another function as a parameter and uses it in a way that the passed-in function is called after the higher-order function terminates. This is referred to as an escaping function.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/escaping-functions/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/for-loops/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "For loops can be used to iterate over a sequence of values.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/for-loops/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/controlflow/#For-In-Loops", 4 | "description": "Swift Book: For-In Loops" 5 | }, 6 | { 7 | "url": "https://developer.apple.com/documentation/swift/stride(from:through:by:)", 8 | "description": "Swift docs: stride" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /concepts/function-overloading/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Function overloading allows functions to use the same name, but with different parameters.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/function-overloading/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/Functions.html", 4 | "description": "Swift.org: Functions" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html#ID312", 8 | "description": "Swift.org: Type Annotations" 9 | }, 10 | { 11 | "url": "https://docs.swift.org/swift-book/LanguageGuide/Functions.html#ID166", 12 | "description": "Swift.org: Argument Labels" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /concepts/higher-order-functions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Higher-order functions means that one can work with functions like regular values.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/higher-order-functions/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/importing/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Importing modules is done using the import keyword followed by the name of the module.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/importing/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/initializers/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Initializers are special methods that are used to set up a value of the enum.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/initializers/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/inout-parameters/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "In-out parameters are use to allow a function to modify the value of a parameter.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/inout-parameters/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#In-Out-Parameters", 4 | "description": "Swift.org: In-Out Parameters" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/loops/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Loops allow repeatedly executing a bit of code.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/loops/about.md: -------------------------------------------------------------------------------- 1 | # Loops 2 | 3 | There are three primary types of loop constructs in Swift: while loops, which repeat a block of code as long as a stated condition holds, repeat-while loops which are similar to while loops but are guaranteed to execute the block of code at least one time, and for-in loops, which execute a block of code once for each element in a collection. 4 | 5 | For more information, see: 6 | 7 | - [concept:swift/while-loops]() 8 | - [concept:swift/repeat-while]() 9 | - [concept:swift/for-loops]() 10 | -------------------------------------------------------------------------------- /concepts/loops/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | There are three primary types of loop constructs in Swift: while loops, repeat-while loops, and for-in loops. 4 | 5 | For more information, see: 6 | 7 | - [concept:swift/while-loops]() 8 | - [concept:swift/repeat-while]() 9 | - [concept:swift/for-loops]() 10 | -------------------------------------------------------------------------------- /concepts/loops/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID135", 4 | "description": "The Swift Language Guide: Control Transfer" 5 | } 6 | ] -------------------------------------------------------------------------------- /concepts/methods/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Methods are functions that are directly linked to a struct or class.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/methods/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/ClassesAndStructures.html", 4 | "description": "Swift.org: Structs and Classes" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/multiple-return-values/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Tuples can be used to return multiple values from a function.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/multiple-return-values/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Multiple values can be returned from Swift functions by creating and returning a tuple from the different values. 4 | 5 | ```swift 6 | func reverseAndLength(_ str: String) -> (reverse: String, length: Int) { 7 | return (reverse: str.reverse, length: str.count) 8 | } 9 | 10 | reverseAndLength("Hello") 11 | // => (reverse: "olleH", length: 5) 12 | ``` 13 | -------------------------------------------------------------------------------- /concepts/multiple-return-values/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/Functions.html", 4 | "description": "Swift.org: Functions" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/nested-functions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Nested functions are functions that are defined inside another function.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/nested-functions/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/functions/#Nested-Functions", 4 | "description": "Swift.org: Nested Functions" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/numbers/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "The two most commonly used number types in Swift are 'Int' and 'Double'.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/opaque-indices/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Opaque indices are indices that are only used to access data, they don't offer any value by themselves.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/opaque-indices/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | Instead of directly indexing into string, one must instead compute a value of type `String.Index` and supply that index instead. Note that these indices are not meant to be human-consumable on their own. They are what is referred to as _opaque indices_ ,as humans need not know what is inside them. 4 | 5 | ```swift 6 | let csv = "apple,pear,peach,orange,cherry,lime,goosberry" 7 | let index = csv.index(csv.startIndex, offsetBy: 21) 8 | csv[index] 9 | // => "g" 10 | print(index) 11 | // => Index(_rawBits: 1376513) 12 | ``` 13 | -------------------------------------------------------------------------------- /concepts/opaque-indices/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Instead of directly indexing into string, one must instead compute a value of type `String.Index` and supply that index instead. Note that these indices are not meant to be human-consumable on their own. They are what is referred to as _opaque indices_ ,as humans need not know what is inside them. 4 | 5 | ```swift 6 | let csv = "apple,pear,peach,orange,cherry,lime,goosberry" 7 | let index = csv.index(csv.startIndex, offsetBy: 21) 8 | csv[index] 9 | // => "g" 10 | print(index) 11 | // => Index(_rawBits: 1376513) 12 | ``` 13 | -------------------------------------------------------------------------------- /concepts/opaque-indices/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/optionals/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Optionals can be used to represent the possible absence of a value.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [ 7 | "meatball133" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /concepts/optionals/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics/#Optionals", 4 | "description": "Swift Book: Optionals" 5 | }, 6 | { 7 | "url": "https://developer.apple.com/documentation/swift/optional", 8 | "description": "Swift docs: Optional" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /concepts/ranges/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Ranges can be used to represent a sequence of values.", 3 | "authors": [ 4 | "meatball133" 5 | ], 6 | "contributors": [ 7 | "IsaacG" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /concepts/ranges/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://developer.apple.com/documentation/swift/range", 4 | "description": "Swift docs: Range" 5 | } 6 | ] -------------------------------------------------------------------------------- /concepts/repeat-while/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Repeat-while loops are loops that execute code while a conditional evaluates to true. That condition is evaluated after the body of the loop is executed.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/repeat-while/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | [Repeat-while loops][repeat-loops] are similar to while loops, however, these loops differ in that the Boolean expression appears, and is evaluated, _after_ the body of the loop is executed. As a result, these loops always execute at least once. 4 | 5 | ```swift 6 | repeat { 7 | print("This runs at least once") 8 | } while false 9 | print("Loop done") 10 | 11 | // prints: 12 | // This runs at least once 13 | // Loop done 14 | ``` 15 | 16 | [repeat-loops]: https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID126 17 | -------------------------------------------------------------------------------- /concepts/repeat-while/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Repeat-while loops are similar to while loops, however, these loops differ in that the Boolean expression appears, and is evaluated, _after_ the body of the loop is executed. As a result, these loops always execute at least once. 4 | 5 | ```swift 6 | repeat { 7 | print("This runs at least once") 8 | } while false 9 | print("Loop done") 10 | 11 | // prints: 12 | // This runs at least once 13 | // Loop done 14 | ``` 15 | -------------------------------------------------------------------------------- /concepts/repeat-while/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/self/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Instances of structs and classes each have an implicit value named self which refers to the instance itself.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/self/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Instances of structs and classes each have an implicit value named `self` which refers to the instance itself. There are multiple uses for `self`, but it is most commonly used to disambiguate the names of properties and methods of the struct/class when there may be some confusion. 4 | 5 | ```swift 6 | struct MySelf { 7 | var x = 0 8 | 9 | mutating func move(x: Int) { 10 | // here if we just say x = x it is unclear if we mean 11 | // the property x or the method parameter x, so we use 12 | // self for clarity 13 | self.x = x 14 | } 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /concepts/self/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/ClassesAndStructures.html", 4 | "description": "Swift.org: Structs and Classes" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/shorthand-arguments/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "When omitting parameters from a closure, they can instead be referred to using a special shorthand syntax.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/shorthand-arguments/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | If the types of the parameters can be inferred, Swift also allows the parameter names and the keyword `in` to be omitted from the closure definition. The parameters can instead be referred to using a special shorthand syntax, where `$0` refers to the first parameter, `$1` refers to the second, and so on. 4 | 5 | ```swift 6 | let mean: (Double, Double) -> Double = { $0 + $1 / 2.0 } 7 | 8 | ["apple", "ball", "carrot"].sorted(by: { $0.count < $1.count }) 9 | ``` 10 | -------------------------------------------------------------------------------- /concepts/shorthand-arguments/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/stored-properties/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Struct and classes can define _stored properties_, which are defined and behave just like regular constants or variables and are stored as part of an instance of that struct/class.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/stored-properties/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/string-indexing/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Individual string characters are indexed via an index.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [ 7 | "meatball133" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /concepts/string-indexing/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/stringsandcharacters/#String-Indices", 4 | "description": "Swift Book: String Indices" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/string-methods/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Strings have a variety of methods that can be used to manipulate them.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/string-methods/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://developer.apple.com/documentation/foundation/nsstring", 4 | "description": "Swift Docs: NSString" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/strings/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Strings are a collection of characters, where characters are, more or less, a single printable element.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/strings/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/structs-and-classes/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Structs and classes provide a way to group together related data and functions into self-contained units of functionality.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/structs-and-classes/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | [Structs and classes][structs-and-classes] are two of the primary building blocks of Swift programming. They are both means of grouping together related data and functions into self-contained units of functionality. All of the basic types that you have been working with up to this point, such as `Int`, `Double`, and `Character` as well as collection types like `Array`, `String`, and `Dictionary` are actually structs. And when you define a struct or class, you are defining a new type to be used within Swift, just as you used those types. 4 | -------------------------------------------------------------------------------- /concepts/structs-and-classes/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/structs/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Structs provide a way to group together related data and functions into self-contained units of functionality.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/structs/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /concepts/ternary-operator/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "The ternary operator allows you to write shorthand if/else statements.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/ternary-operator/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/basicoperators/#Ternary-Conditional-Operator", 4 | "description": "Swift Book: Ternary-Conditional-Operator" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/trailing-closures/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Trailing closures arise when the last parameter in a function's list of parameters has a function type.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/trailing-closures/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "http://goshdarnclosuresyntax.com", 4 | "description": "Gosh Darn Closure Syntax" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/tuples/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Tuples are used to combine multiple values into a single compound value where each of the values may have a different type.", 3 | "authors": [ 4 | "wneumann", 5 | "meatball133" 6 | ], 7 | "contributors": [] 8 | } 9 | -------------------------------------------------------------------------------- /concepts/tuples/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics/#Tuples", 4 | "description": "Swift Book: Tuples" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/functions/#Functions-with-Multiple-Return-Values", 8 | "description": "Swift Book: Functions-with-Multiple-Return-Values" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /concepts/value-and-reference-types/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "All types fall into one of two different classifications: value types or reference types.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/value-and-reference-types/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/LanguageGuide/ClassesAndStructures.html", 4 | "description": "Swift.org: Structs and Classes" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/variadic-parameters/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Variadic parameters allow zero or more values of the same type to be passed into a single parameter in a function.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [] 7 | } 8 | -------------------------------------------------------------------------------- /concepts/variadic-parameters/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/functions/#Variadic-Parameters", 4 | "description": "Swift.org: Variadic Parameters" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /concepts/while-and-repeat-loops/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "While and repeat while loops allow repeatedly executing a bit of code while a condition evaluates to true.", 3 | "authors": [ 4 | "wneumann" 5 | ], 6 | "contributors": [ 7 | "meatball133" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /concepts/while-and-repeat-loops/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/controlflow/#While-Loops", 4 | "description": "Swift Book: While Loops" 5 | }, 6 | { 7 | "url": "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/controlflow/#Repeat-While", 8 | "description": "Swift Book: Repeat-While" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /docs/SNIPPET.txt: -------------------------------------------------------------------------------- 1 | // 2 | // HelloWorld.swift 3 | // 4 | 5 | struct HelloWorld { 6 | static func hello(_ text: String = "World") -> String { 7 | return "Hello, \(text)!" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /exercises/concept/bird-watcher/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/bird-watcher/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "meatball133" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/BirdWatcher/BirdWatcher.swift" 8 | ], 9 | "test": [ 10 | "Tests/BirdWatcherTests/BirdWatcherTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/BirdWatcher/BirdWatcherExemplar.swift" 14 | ] 15 | }, 16 | "forked_from": [ 17 | "go/bird-watcher" 18 | ], 19 | "blurb": "Count the birds in your garden with for loops." 20 | } 21 | -------------------------------------------------------------------------------- /exercises/concept/bird-watcher/Sources/BirdWatcher/BirdWatcher.swift: -------------------------------------------------------------------------------- 1 | func totalBirdCount(_ birdsPerDay: [Int]) -> Int { 2 | fatalError("Please implement the totalBirdCount(_:) function") 3 | } 4 | 5 | func birdsInWeek(_ birdsPerDay: [Int], weekNumber: Int) -> Int { 6 | fatalError("Please implement the birdsInWeek(_:weekNumber:) function") 7 | } 8 | 9 | func fixBirdCountLog(_ birdsPerDay: [Int]) -> [Int] { 10 | fatalError("Please implement the fixBirdCountLog(_:) function") 11 | } 12 | -------------------------------------------------------------------------------- /exercises/concept/bomb-defuser/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/bomb-defuser/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/BombDefuser/BombDefuser.swift" 8 | ], 9 | "test": [ 10 | "Tests/BombDefuserTests/BombDefuserTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/BombDefuser/BombDefuserExemplar.swift" 14 | ] 15 | }, 16 | "blurb": "Learn about closures by preventing a bomb from exploding at the Governor's ball." 17 | } 18 | -------------------------------------------------------------------------------- /exercises/concept/chessboard/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/chessboard/.meta/Sources/Chessboard/ChessboardExemplar.swift: -------------------------------------------------------------------------------- 1 | let ranks = 1...8 2 | let files = "A"..."H" 3 | 4 | func isValidSquare(rank: Int, file: String) -> Bool { 5 | return ranks.contains(rank) && files.contains(file) 6 | } 7 | 8 | func getRow(_ board : [String], rank: Int) -> [String] { 9 | let startIndex = (rank - 1) * 8 10 | let endIndex = startIndex + 8 11 | return Array(board[startIndex.. Bool { 6 | fatalError("Please implement the isValidSquare(rank:file:) function") 7 | } 8 | 9 | func getRow(_ board : [String], rank: Int) -> [String] { 10 | fatalError("Please implement the getRow(_:rank:) function") 11 | } 12 | -------------------------------------------------------------------------------- /exercises/concept/custom-signs/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/custom-signs/.meta/Sources/CustomSigns/CustomSignsExemplar.swift: -------------------------------------------------------------------------------- 1 | let birthday = "Birthday" 2 | let valentine = "Valentine's Day" 3 | let anniversary = "Anniversary" 4 | 5 | let space: Character = " " 6 | let exclamation: Character = "!" 7 | 8 | func buildSign(for occasion: String, name: String) -> String { 9 | return "Happy " + occasion + String(space) + name + String(exclamation) 10 | } 11 | 12 | func graduationFor(name: String, year: Int) -> String { 13 | "Congratulations \(name)!\nClass of \(year)" 14 | } 15 | 16 | func costOf(sign: String) -> Int { 17 | sign.count * 2 + 20 18 | } 19 | -------------------------------------------------------------------------------- /exercises/concept/custom-signs/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann", 4 | "meatball133" 5 | ], 6 | "files": { 7 | "solution": [ 8 | "Sources/CustomSigns/CustomSigns.swift" 9 | ], 10 | "test": [ 11 | "Tests/CustomSignsTests/CustomSignsTests.swift" 12 | ], 13 | "exemplar": [ 14 | ".meta/Sources/CustomSigns/CustomSignsExemplar.swift" 15 | ] 16 | }, 17 | "blurb": "Learn about characters by helping a sign company create custom messages for their signs." 18 | } 19 | -------------------------------------------------------------------------------- /exercises/concept/expert-mixologist/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/expert-mixologist/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "contributors": [ 6 | "meatball133" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "Sources/ExpertMixologist/ExpertMixologist.swift" 11 | ], 12 | "test": [ 13 | "Tests/ExpertMixologistTests/ExpertMixologistTests.swift" 14 | ], 15 | "exemplar": [ 16 | ".meta/Sources/ExpertMixologist/ExpertMixologistExemplar.swift" 17 | ] 18 | }, 19 | "blurb": "Learn about loops by making tasty drinks for the public to enjoy on their nights out." 20 | } 21 | -------------------------------------------------------------------------------- /exercises/concept/freelancer-rates/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/freelancer-rates/Sources/FreelancerRates/FreelancerRates.swift: -------------------------------------------------------------------------------- 1 | func dailyRateFrom(hourlyRate: Int) -> Double { 2 | fatalError("Please implement the dailyRateFrom(hourlyRate:) function") 3 | } 4 | 5 | func monthlyRateFrom(hourlyRate: Int, withDiscount discount: Double) -> Double { 6 | fatalError("Please implement the monthlyRateFrom(hourlyRate:withDiscount:) function") 7 | } 8 | 9 | func workdaysIn(budget: Double, hourlyRate: Int, withDiscount discount: Double) -> Double { 10 | fatalError("Please implement the workdaysIn(budget:hourlyRate:withDiscount:) function") 11 | } 12 | -------------------------------------------------------------------------------- /exercises/concept/high-score-board/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/high-score-board/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/HighScoreBoard/HighScoreBoard.swift" 8 | ], 9 | "test": [ 10 | "Tests/HighScoreBoardTests/HighScoreBoardTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/HighScoreBoard/HighScoreBoardExemplar.swift" 14 | ] 15 | }, 16 | "forked_from": [ 17 | "elixir/high-score" 18 | ], 19 | "blurb": "Learn about dictionaries by tracking high scores of an arcade game." 20 | } 21 | -------------------------------------------------------------------------------- /exercises/concept/lasagna-master/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/lasagna-master/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/LasagnaMaster/LasagnaMaster.swift" 8 | ], 9 | "test": [ 10 | "Tests/LasagnaMasterTests/LasagnaMasterTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/LasagnaMaster/LasagnaMasterExemplar.swift" 14 | ] 15 | }, 16 | "blurb": "Dig deeper into functions by cooking your favorite lasagna." 17 | } 18 | -------------------------------------------------------------------------------- /exercises/concept/lasagna-master/Sources/LasagnaMaster/LasagnaMaster.swift: -------------------------------------------------------------------------------- 1 | // TODO: define the 'remainingMinutesInOven' function 2 | 3 | // TODO: define the 'preparationTimeInMinutes' function 4 | 5 | // TODO: define the 'quantities' function 6 | 7 | // TODO: define the 'toOz' function 8 | 9 | // TODO: define the 'redWine' function 10 | -------------------------------------------------------------------------------- /exercises/concept/lasagna/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/lasagna/.meta/Sources/Lasagna/LasagnaExemplar.swift: -------------------------------------------------------------------------------- 1 | let expectedMinutesInOven = 40 2 | 3 | func remainingMinutesInOven(elapsedMinutes minutes: Int) -> Int { 4 | return expectedMinutesInOven - minutes 5 | } 6 | 7 | func preparationTimeInMinutes(layers: Int) -> Int { 8 | return 2 * layers 9 | } 10 | 11 | func totalTimeInMinutes(layers: Int, elapsedMinutes minutes: Int) -> Int { 12 | return preparationTimeInMinutes(layers: layers) + minutes 13 | } 14 | -------------------------------------------------------------------------------- /exercises/concept/lasagna/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann", 4 | "meatball133" 5 | ], 6 | "files": { 7 | "solution": [ 8 | "Sources/Lasagna/Lasagna.swift" 9 | ], 10 | "test": [ 11 | "Tests/LasagnaTests/LasagnaTests.swift" 12 | ], 13 | "exemplar": [ 14 | ".meta/Sources/Lasagna/LasagnaExemplar.swift" 15 | ] 16 | }, 17 | "language_versions": ">=6.0", 18 | "forked_from": [ 19 | "fsharp/lucians-luscious-lasagna" 20 | ], 21 | "blurb": "Learn the basics of Swift cooking a brilliant lasagna from your favorite cooking book" 22 | } 23 | -------------------------------------------------------------------------------- /exercises/concept/lasagna/Sources/Lasagna/Lasagna.swift: -------------------------------------------------------------------------------- 1 | // TODO: define the 'expectedMinutesInOven' constant 2 | 3 | // TODO: define the 'remainingMinutesInOven' function 4 | 5 | // TODO: define the 'preparationTimeInMinutes' function 6 | 7 | // TODO: define the 'totalTimeInMinutes' function 8 | -------------------------------------------------------------------------------- /exercises/concept/log-lines/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/log-lines/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/LogLines/LogLines.swift" 8 | ], 9 | "test": [ 10 | "Tests/LogLinesTests/LogLinesTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/LogLines/LogLinesExemplar.swift" 14 | ] 15 | }, 16 | "forked_from": [ 17 | "csharp/logs-logs-logs" 18 | ], 19 | "icon": "logs-logs-logs", 20 | "blurb": "Learn about strings by parsing application logs" 21 | } 22 | -------------------------------------------------------------------------------- /exercises/concept/log-lines/Sources/LogLines/LogLines.swift: -------------------------------------------------------------------------------- 1 | // TODO: define the 'LogLevel' enum, its `init`, and its `shortFormat` method 2 | -------------------------------------------------------------------------------- /exercises/concept/magician-in-training/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/magician-in-training/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann", 4 | "meatball133" 5 | ], 6 | "files": { 7 | "solution": [ 8 | "Sources/MagicianInTraining/MagicianInTraining.swift" 9 | ], 10 | "test": [ 11 | "Tests/MagicianInTrainingTests/MagicianInTrainingTests.swift" 12 | ], 13 | "exemplar": [ 14 | ".meta/Sources/MagicianInTraining/MagicianInTrainingExemplar.swift" 15 | ] 16 | }, 17 | "forked_from": [ 18 | "go/card-tricks" 19 | ], 20 | "blurb": "Help Elyse with her Enchantments and learn about arrays in the process." 21 | } 22 | -------------------------------------------------------------------------------- /exercises/concept/pizza-slices/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/pizza-slices/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/PizzaSlices/PizzaSlices.swift" 8 | ], 9 | "test": [ 10 | "Tests/PizzaSlicesTests/PizzaSlicesTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/PizzaSlices/PizzaSlicesExemplar.swift" 14 | ] 15 | }, 16 | "blurb": "Learn about optionals by finding the pizza configuration to give you the largest slice." 17 | } 18 | -------------------------------------------------------------------------------- /exercises/concept/pizza-slices/Sources/PizzaSlices/PizzaSlices.swift: -------------------------------------------------------------------------------- 1 | func sliceSize(diameter: Double?, slices: Int?) -> Double? { 2 | fatalError("Please implement the sliceSize(diameter:slices:) function") 3 | } 4 | 5 | func biggestSlice( 6 | diameterA: String, slicesA: String, 7 | diameterB: String, slicesB: String 8 | ) -> String { 9 | fatalError("Please implement the biggestSlice(diameterA:slicesA:diameterB:slicesB:) function") 10 | } 11 | -------------------------------------------------------------------------------- /exercises/concept/poetry-club/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/poetry-club/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "contributors": [ 6 | "meatball133" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "Sources/PoetryClub/PoetryClub.swift" 11 | ], 12 | "test": [ 13 | "Tests/PoetryClubTests/PoetryClubTests.swift" 14 | ], 15 | "exemplar": [ 16 | ".meta/Sources/PoetryClub/PoetryClubExemplar.swift" 17 | ] 18 | }, 19 | "forked_from": [ 20 | "javascript/poetry-club-door-policy" 21 | ], 22 | "blurb": "Learn about strings using poems to get into your local poetry club." 23 | } 24 | -------------------------------------------------------------------------------- /exercises/concept/poetry-club/Sources/PoetryClub/PoetryClub.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func splitOnNewlines(_ poem: String) -> [String] { 4 | fatalError("Please implement the splitOnNewlines(_:) function") 5 | } 6 | 7 | func frontDoorPassword(_ phrase: String) -> String { 8 | fatalError("Please implement the frontDoorPassword(_:) function") 9 | } 10 | 11 | func backDoorPassword(_ phrase: String) -> String { 12 | fatalError("Please implement the backDoorPassword(_:) function") 13 | } 14 | 15 | func secretRoomPassword(_ phrase: String) -> String { 16 | fatalError("Please implement the secretRoomPassword(_:) function") 17 | } 18 | -------------------------------------------------------------------------------- /exercises/concept/santas-helper/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/santas-helper/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann", 4 | "meatball133" 5 | ], 6 | "files": { 7 | "solution": [ 8 | "Sources/SantasHelper/SantasHelper.swift" 9 | ], 10 | "test": [ 11 | "Tests/SantasHelperTests/SantasHelperTests.swift" 12 | ], 13 | "exemplar": [ 14 | ".meta/Sources/SantasHelper/SantasHelperExemplar.swift" 15 | ] 16 | }, 17 | "blurb": "Learn about tuples by upgrading the system software of Santa's logistics division." 18 | } 19 | -------------------------------------------------------------------------------- /exercises/concept/secret-agent/.docs/hints.md: -------------------------------------------------------------------------------- 1 | # Hints 2 | 3 | ## 1. Protect the recovered secret plans with a password: 4 | 5 | - Your returned function will need to access the passed-in password. 6 | - You can compare passwords using string equality or switch statement cases. 7 | 8 | ## 2. Generate a combination to open their safe: 9 | 10 | - The room number is not a part of the combination. 11 | -------------------------------------------------------------------------------- /exercises/concept/secret-agent/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/secret-agent/.meta/Sources/SecretAgent/SecretAgentExemplar.swift: -------------------------------------------------------------------------------- 1 | func generateCombination(forRoom room: Int, usingFunction f: (Int) -> Int) -> (Int, Int, Int) { 2 | let a = f(room) 3 | let b = f(a) 4 | let c = f(b) 5 | return (a, b, c) 6 | } 7 | 8 | func protectSecret(_ secret: String, withPassword password: String) -> (String) -> String { 9 | func protected(_ pass: String) -> String { 10 | if pass == password { 11 | return secret 12 | } else { 13 | return "Sorry. No hidden secrets here." 14 | } 15 | } 16 | return protected 17 | } 18 | -------------------------------------------------------------------------------- /exercises/concept/secret-agent/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/SecretAgent/SecretAgent.swift" 8 | ], 9 | "test": [ 10 | "Tests/SecretAgentTests/SecretAgentTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/SecretAgent/SecretAgentExemplar.swift" 14 | ] 15 | }, 16 | "blurb": "Learn about higher-order functions by becoming a spy and infiltrate the secret UMBRA headquarters" 17 | } 18 | -------------------------------------------------------------------------------- /exercises/concept/secret-agent/Sources/SecretAgent/SecretAgent.swift: -------------------------------------------------------------------------------- 1 | func protectSecret(_ secret: String, withPassword password: String) -> (String) -> String { 2 | fatalError("Please implement the protectSecret(_:withPassword:) function") 3 | } 4 | 5 | func generateCombination(forRoom room: Int, usingFunction f: (Int) -> Int) -> (Int, Int, Int) { 6 | fatalError("Please implement the generateCombination(forRoom:usingFunction) function") 7 | } 8 | -------------------------------------------------------------------------------- /exercises/concept/vehicle-purchase/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/vehicle-purchase/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann", 4 | "meatball133" 5 | ], 6 | "files": { 7 | "solution": [ 8 | "Sources/VehiclePurchase/VehiclePurchase.swift" 9 | ], 10 | "test": [ 11 | "Tests/VehiclePurchaseTests/VehiclePurchaseTests.swift" 12 | ], 13 | "exemplar": [ 14 | ".meta/Sources/VehiclePurchase/VehiclePurchaseExemplar.swift" 15 | ] 16 | }, 17 | "blurb": "Learn about conditionals while preparing for your next vehicle purchase" 18 | } 19 | -------------------------------------------------------------------------------- /exercises/concept/vehicle-purchase/Sources/VehiclePurchase/VehiclePurchase.swift: -------------------------------------------------------------------------------- 1 | func canIBuy(vehicle: String, price: Double, monthlyBudget: Double) -> String { 2 | fatalError("Please implement the canIBuy(vehicle:price:monthlyBudget:) function") 3 | } 4 | 5 | func licenseType(numberOfWheels wheels: Int) -> String { 6 | fatalError("Please implement licenseType(numberOfWheels:) function") 7 | } 8 | 9 | func calculateResellPrice(originalPrice: Int, yearsOld: Int) -> Int { 10 | fatalError("Please implement calculateResellPrice(originalPrice:yearsOld:) function") 11 | } 12 | -------------------------------------------------------------------------------- /exercises/concept/windowing-system/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/windowing-system/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "wneumann" 4 | ], 5 | "contributors": [ 6 | "meatball133" 7 | ], 8 | "files": { 9 | "solution": [ 10 | "Sources/WindowingSystem/WindowingSystem.swift" 11 | ], 12 | "test": [ 13 | "Tests/WindowingSystemTests/WindowingSystemTests.swift" 14 | ], 15 | "exemplar": [ 16 | ".meta/Sources/WindowingSystem/WindowingSystemExemplar.swift" 17 | ] 18 | }, 19 | "blurb": "Learn about structs and classes by simulating a windowing based computer system." 20 | } 21 | -------------------------------------------------------------------------------- /exercises/concept/windowing-system/Sources/WindowingSystem/WindowingSystem.swift: -------------------------------------------------------------------------------- 1 | // TODO: Define the Size struct 2 | 3 | // TODO: Define the Position struct 4 | 5 | // TODO: Define the Window class 6 | -------------------------------------------------------------------------------- /exercises/concept/wings-quest/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /exercises/concept/wings-quest/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "meatball133" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/WingsQuest/WingsQuest.swift" 8 | ], 9 | "test": [ 10 | "Tests/WingsQuestTests/WingsQuestTests.swift" 11 | ], 12 | "exemplar": [ 13 | ".meta/Sources/WingsQuest/WingsQuestExemplar.swift" 14 | ] 15 | }, 16 | "forked_from": [ 17 | "elixir/pacman-rules", 18 | "Crystal/crystal-hunter" 19 | ], 20 | "icon": "low-power-embedded-game", 21 | "blurb": "Learn about booleans by implementing the rules of the Wind Quest game." 22 | } 23 | -------------------------------------------------------------------------------- /exercises/concept/wings-quest/.meta/design.md: -------------------------------------------------------------------------------- 1 | ## Goal 2 | 3 | The goal of this exercise is to teach the student about Bools in Swift. 4 | 5 | ## Learning objectives 6 | 7 | - Know what a Bool is (True and False) 8 | - Know how to use `!`, `&&`, and `||` 9 | - Know that you can affect the result of Bool with parentheses. 10 | 11 | ## Out of scope 12 | 13 | - Using comparison operators 14 | - If statements 15 | 16 | ## Concepts 17 | 18 | `Bools`: 19 | 20 | - Bools (`true`, `false`) 21 | - `&&`, `||`, `!` 22 | 23 | ## Prerequisites 24 | 25 | - Basic 26 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/.meta/Sources/Accumulate/AccumulateExample.swift: -------------------------------------------------------------------------------- 1 | extension Array { 2 | func accumulate(_ yield: (Element) -> S) -> [S] { 3 | var result: [S] = [S]() 4 | for item in self { 5 | result.append(yield(item)) 6 | } 7 | return result 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Accumulate", 7 | products: [ 8 | .library( 9 | name: "Accumulate", 10 | targets: ["Accumulate"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Accumulate", 16 | dependencies: []), 17 | .testTarget( 18 | name: "AccumulateTests", 19 | dependencies: ["Accumulate"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/Sources/Accumulate/Accumulate.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.meta/Sources/Acronym/AcronymExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | class Acronym { 4 | static func abbreviate(_ phrase: String) -> String { 5 | let words = phrase.components(separatedBy: CharacterSet(charactersIn: " -_")) 6 | var acronym = "" 7 | 8 | for word in words { 9 | if let firstCharacter = word.first { 10 | acronym.append(String(firstCharacter).uppercased()) 11 | } 12 | } 13 | 14 | return acronym 15 | } 16 | } -------------------------------------------------------------------------------- /exercises/practice/acronym/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Acronym", 7 | products: [ 8 | .library( 9 | name: "Acronym", 10 | targets: ["Acronym"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Acronym", 16 | dependencies: []), 17 | .testTarget( 18 | name: "AcronymTests", 19 | dependencies: ["Acronym"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/acronym/Sources/Acronym/Acronym.swift: -------------------------------------------------------------------------------- 1 | struct Acronym { 2 | static func abbreviate(_ inString: String) -> String { 3 | // Write your code for the 'Acronym' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/all-your-base/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You've just been hired as professor of mathematics. 4 | Your first week went well, but something is off in your second week. 5 | The problem is that every answer given by your students is wrong! 6 | Luckily, your math skills have allowed you to identify the problem: the student answers _are_ correct, but they're all in base 2 (binary)! 7 | Amazingly, it turns out that each week, the students use a different base. 8 | To help you quickly verify the student answers, you'll be building a tool to translate between bases. 9 | -------------------------------------------------------------------------------- /exercises/practice/all-your-base/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/all-your-base/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "AllYourBase", 7 | products: [ 8 | .library( 9 | name: "AllYourBase", 10 | targets: ["AllYourBase"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "AllYourBase", 16 | dependencies: []), 17 | .testTarget( 18 | name: "AllYourBaseTests", 19 | dependencies: ["AllYourBase"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/all-your-base/Sources/AllYourBase/AllYourBase.swift: -------------------------------------------------------------------------------- 1 | struct Base { 2 | static func outputDigits(inputBase: Int, inputDigits: [Int], outputBase: Int) throws -> [Int] { 3 | // Write your code for the 'All-Your-Bases' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/allergies/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/allergies/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Allergies", 7 | products: [ 8 | .library( 9 | name: "Allergies", 10 | targets: ["Allergies"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Allergies", 16 | dependencies: []), 17 | .testTarget( 18 | name: "AllergiesTests", 19 | dependencies: ["Allergies"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/allergies/Sources/Allergies/Allergies.swift: -------------------------------------------------------------------------------- 1 | class Allergies { 2 | // Write your code for the 'Allergies' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/anagram/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | # Instructions Append 2 | 3 | You must return the anagrams in the same order as they are listed in the candidate words. 4 | -------------------------------------------------------------------------------- /exercises/practice/anagram/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/anagram/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Anagram", 7 | products: [ 8 | .library( 9 | name: "Anagram", 10 | targets: ["Anagram"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Anagram", 16 | dependencies: []), 17 | .testTarget( 18 | name: "AnagramTests", 19 | dependencies: ["Anagram"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/anagram/Sources/Anagram/Anagram.swift: -------------------------------------------------------------------------------- 1 | class Anagram { 2 | // Write your code for the 'Anagram' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/.meta/Sources/ArmstrongNumbers/ArmstrongNumbersExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func isArmstrongNumber(_ number: Int) -> Bool { 4 | let stringNumber = String(number) 5 | let numberLength = stringNumber.count 6 | let sum = stringNumber.compactMap { Int(String($0)) }.reduce(0) { $0 + Int(pow(Double($1), Double(numberLength))) } 7 | return sum == number 8 | } 9 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "meatball133" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/ArmstrongNumbers/ArmstrongNumbers.swift" 8 | ], 9 | "test": [ 10 | "Tests/ArmstrongNumbersTests/ArmstrongNumbersTests.swift" 11 | ], 12 | "example": [ 13 | ".meta/Sources/ArmstrongNumbers/ArmstrongNumbersExample.swift" 14 | ] 15 | }, 16 | "blurb": "Determine if a number is an Armstrong number.", 17 | "source": "Wikipedia", 18 | "source_url": "https://en.wikipedia.org/wiki/Narcissistic_number" 19 | } 20 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ArmstrongNumbers", 7 | products: [ 8 | .library( 9 | name: "ArmstrongNumbers", 10 | targets: ["ArmstrongNumbers"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "ArmstrongNumbers", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ArmstrongNumbersTests", 19 | dependencies: ["ArmstrongNumbers"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/Sources/ArmstrongNumbers/ArmstrongNumbers.swift: -------------------------------------------------------------------------------- 1 | func isArmstrongNumber(_ number: Int) -> Bool { 2 | // Write your code for the 'Armstrong Numbers' exercise here. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "AtbashCipher", 7 | products: [ 8 | .library( 9 | name: "AtbashCipher", 10 | targets: ["AtbashCipher"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "AtbashCipher", 16 | dependencies: []), 17 | .testTarget( 18 | name: "AtbashCipherTests", 19 | dependencies: ["AtbashCipher"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/Sources/AtbashCipher/AtbashCipher.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | class AtbashCipher { 4 | // Write your code for the 'AtbashCipher' exercise in this file. 5 | static func encode(_ phrase: String) -> String { 6 | } 7 | 8 | static func decode(_ phrase: String) -> String { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "BeerSong", 7 | products: [ 8 | .library( 9 | name: "BeerSong", 10 | targets: ["BeerSong"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "BeerSong", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BeerSongTests", 19 | dependencies: ["BeerSong"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/Sources/BeerSong/BeerSong.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/binary-search-tree/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/binary-search-tree/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "BinarySearchTree", 7 | products: [ 8 | .library( 9 | name: "BinarySearchTree", 10 | targets: ["BinarySearchTree"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "BinarySearchTree", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BinarySearchTreeTests", 19 | dependencies: ["BinarySearchTree"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/binary-search-tree/Sources/BinarySearchTree/BinarySearchTree.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "BinarySearch", 7 | products: [ 8 | .library( 9 | name: "BinarySearch", 10 | targets: ["BinarySearch"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "BinarySearch", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BinarySearchTests", 19 | dependencies: ["BinarySearch"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/Sources/BinarySearch/BinarySearch.swift: -------------------------------------------------------------------------------- 1 | class BinarySearch { 2 | // Write your code for the 'BinarySearch' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/binary/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/binary/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Binary", 7 | products: [ 8 | .library( 9 | name: "Binary", 10 | targets: ["Binary"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Binary", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BinaryTests", 19 | dependencies: ["Binary"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/binary/Sources/Binary/Binary.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/bob/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Bob is a [lackadaisical][] teenager. 4 | He likes to think that he's very cool. 5 | And he definitely doesn't get excited about things. 6 | That wouldn't be cool. 7 | 8 | When people talk to him, his responses are pretty limited. 9 | 10 | [lackadaisical]: https://www.collinsdictionary.com/dictionary/english/lackadaisical 11 | -------------------------------------------------------------------------------- /exercises/practice/bob/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/bob/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Bob", 7 | products: [ 8 | .library( 9 | name: "Bob", 10 | targets: ["Bob"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Bob", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BobTests", 19 | dependencies: ["Bob"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/bob/Sources/Bob/Bob.swift: -------------------------------------------------------------------------------- 1 | class Bob { 2 | static func response(_ message: String) -> String { 3 | // Write your code for the 'Bob' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/bottle-song/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/bottle-song/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "meatball133" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/BottleSong/BottleSong.swift" 8 | ], 9 | "test": [ 10 | "Tests/BottleSongTests/BottleSongTests.swift" 11 | ], 12 | "example": [ 13 | ".meta/Sources/BottleSong/BottleSongExample.swift" 14 | ] 15 | }, 16 | "blurb": "Produce the lyrics to the popular children's repetitive song: Ten Green Bottles.", 17 | "source": "Wikipedia", 18 | "source_url": "https://en.wikipedia.org/wiki/Ten_Green_Bottles" 19 | } 20 | -------------------------------------------------------------------------------- /exercises/practice/bottle-song/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "BottleSong", 7 | products: [ 8 | .library( 9 | name: "BottleSong", 10 | targets: ["BottleSong"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "BottleSong", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BottleSongTests", 19 | dependencies: ["BottleSong"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/bottle-song/Sources/BottleSong/BottleSong.swift: -------------------------------------------------------------------------------- 1 | class BottleSong { 2 | // Write your code for the 'BottleSong' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/bowling/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/bowling/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Bowling", 7 | products: [ 8 | .library( 9 | name: "Bowling", 10 | targets: ["Bowling"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Bowling", 16 | dependencies: []), 17 | .testTarget( 18 | name: "BowlingTests", 19 | dependencies: ["Bowling"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/bowling/Sources/Bowling/Bowling.swift: -------------------------------------------------------------------------------- 1 | class Bowling { 2 | // Write your code for the 'Bowling' exercise in this file. 3 | func roll(pins: Int) throws { 4 | } 5 | 6 | func score() throws -> Int { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "CircularBuffer", 7 | products: [ 8 | .library( 9 | name: "CircularBuffer", 10 | targets: ["CircularBuffer"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "CircularBuffer", 16 | dependencies: []), 17 | .testTarget( 18 | name: "CircularBufferTests", 19 | dependencies: ["CircularBuffer"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/Sources/CircularBuffer/CircularBuffer.swift: -------------------------------------------------------------------------------- 1 | struct CircularBuffer { 2 | // Write your code for the 'CircularBuffer' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/clock/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Implement a clock that handles times without dates. 4 | 5 | You should be able to add and subtract minutes to it. 6 | 7 | Two clocks that represent the same time should be equal to each other. 8 | -------------------------------------------------------------------------------- /exercises/practice/clock/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/clock/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Clock", 7 | products: [ 8 | .library( 9 | name: "Clock", 10 | targets: ["Clock"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Clock", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ClockTests", 19 | dependencies: ["Clock"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/clock/Sources/Clock/Clock.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct Clock: Equatable { 4 | // Write your code for the 'Clock' exercise in this file. 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture. 4 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "CollatzConjecture", 7 | products: [ 8 | .library( 9 | name: "CollatzConjecture", 10 | targets: ["CollatzConjecture"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "CollatzConjecture", 16 | dependencies: []), 17 | .testTarget( 18 | name: "CollatzConjectureTests", 19 | dependencies: ["CollatzConjecture"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/Sources/CollatzConjecture/CollatzConjecture.swift: -------------------------------------------------------------------------------- 1 | class CollatzConjecture { 2 | static func steps(_ number: Int) throws -> Int? { 3 | // Write your code for the 'Collatz Conjecture' exercise here. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/complex-numbers/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/complex-numbers/Sources/ComplexNumbers/ComplexNumbers.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/crypto-square/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/crypto-square/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "CryptoSquare", 7 | products: [ 8 | .library( 9 | name: "CryptoSquare", 10 | targets: ["CryptoSquare"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "CryptoSquare", 16 | dependencies: []), 17 | .testTarget( 18 | name: "CryptoSquareTests", 19 | dependencies: ["CryptoSquare"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/crypto-square/Sources/CryptoSquare/CryptoSquare.swift: -------------------------------------------------------------------------------- 1 | func cryptoSquare(text: String) -> String { 2 | // Write your code for the 'Crypto Square' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/custom-set/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Create a custom set type. 4 | 5 | Sometimes it is necessary to define a custom data structure of some type, like a set. 6 | In this exercise you will define your own set. 7 | How it works internally doesn't matter, as long as it behaves like a set of unique elements. 8 | -------------------------------------------------------------------------------- /exercises/practice/custom-set/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/custom-set/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "masters3d" 4 | ], 5 | "contributors": [ 6 | "bhargavg", 7 | "hankturowski", 8 | "harquail", 9 | "lyuha", 10 | "robtimp", 11 | "samkrishna", 12 | "ThomasHaz" 13 | ], 14 | "files": { 15 | "solution": [ 16 | "Sources/CustomSet/CustomSet.swift" 17 | ], 18 | "test": [ 19 | "Tests/CustomSetTests/CustomSetTests.swift" 20 | ], 21 | "example": [ 22 | ".meta/Sources/CustomSet/CustomSetExample.swift" 23 | ] 24 | }, 25 | "blurb": "Create a custom set type." 26 | } 27 | -------------------------------------------------------------------------------- /exercises/practice/custom-set/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "CustomSet", 7 | products: [ 8 | .library( 9 | name: "CustomSet", 10 | targets: ["CustomSet"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "CustomSet", 16 | dependencies: []), 17 | .testTarget( 18 | name: "CustomSetTests", 19 | dependencies: ["CustomSet"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/custom-set/Sources/CustomSet/CustomSet.swift: -------------------------------------------------------------------------------- 1 | // Write your code for the 'Custom-Set' exercise in this file. 2 | -------------------------------------------------------------------------------- /exercises/practice/darts/.meta/Sources/Darts/DartsExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func dartScore(x: Double, y: Double) -> Int { 4 | let distance = sqrt(x * x + y * y) 5 | switch distance { 6 | case 0...1: 7 | return 10 8 | case 1...5: 9 | return 5 10 | case 5...10: 11 | return 1 12 | default: 13 | return 0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /exercises/practice/darts/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "meatball133" 4 | ], 5 | "files": { 6 | "solution": [ 7 | "Sources/Darts/Darts.swift" 8 | ], 9 | "test": [ 10 | "Tests/DartsTests/DartsTests.swift" 11 | ], 12 | "example": [ 13 | ".meta/Sources/Darts/DartsExample.swift" 14 | ] 15 | }, 16 | "blurb": "Calculate the points scored in a single toss of a Darts game.", 17 | "source": "Inspired by an exercise created by a professor Della Paolera in Argentina" 18 | } 19 | -------------------------------------------------------------------------------- /exercises/practice/darts/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Darts", 7 | products: [ 8 | .library( 9 | name: "Darts", 10 | targets: ["Darts"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Darts", 16 | dependencies: []), 17 | .testTarget( 18 | name: "DartsTests", 19 | dependencies: ["Darts"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/darts/Sources/Darts/Darts.swift: -------------------------------------------------------------------------------- 1 | func dartScore(x: Double, y: Double) -> Int { 2 | // Write your code for the 'Darts' exercise here. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/diamond/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/diamond/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Diamond", 7 | products: [ 8 | .library( 9 | name: "Diamond", 10 | targets: ["Diamond"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Diamond", 16 | dependencies: []), 17 | .testTarget( 18 | name: "DiamondTests", 19 | dependencies: ["Diamond"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/diamond/Sources/Diamond/Diamond.swift: -------------------------------------------------------------------------------- 1 | class Diamond { 2 | static func makeDiamond(letter: Character) -> [String] { 3 | // Write your code for the 'Diamond' exercise here. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/.meta/Sources/DifferenceOfSquares/DifferenceOfSquaresExample.swift: -------------------------------------------------------------------------------- 1 | struct Squares { 2 | 3 | var max = 1 4 | 5 | init(_ max: Int) { 6 | if max > 0 { 7 | self.max = max 8 | } 9 | } 10 | 11 | var squareOfSum: Int { 12 | let numbers = Array(1...self.max) 13 | let sum = numbers.reduce(0, +) 14 | return sum * sum 15 | } 16 | 17 | var sumOfSquares: Int { 18 | let numbers = Array(1...self.max) 19 | return numbers.map { return $0 * $0 }.reduce(0, +) 20 | } 21 | 22 | var differenceOfSquares: Int { 23 | return squareOfSum - sumOfSquares 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "DifferenceOfSquares", 7 | products: [ 8 | .library( 9 | name: "DifferenceOfSquares", 10 | targets: ["DifferenceOfSquares"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "DifferenceOfSquares", 16 | dependencies: []), 17 | .testTarget( 18 | name: "DifferenceOfSquaresTests", 19 | dependencies: ["DifferenceOfSquares"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/Sources/DifferenceOfSquares/DifferenceOfSquares.swift: -------------------------------------------------------------------------------- 1 | class Squares { 2 | // Write your code for the 'Difference Of Squares' exercise here. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/dominoes/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/dominoes/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "masters3d", 4 | "meatball133" 5 | ], 6 | "contributors": [ 7 | "bhargavg", 8 | "harquail", 9 | "kytrinyx", 10 | "lyuha", 11 | "petertseng", 12 | "robtimp", 13 | "ThomasHaz" 14 | ], 15 | "files": { 16 | "solution": [ 17 | "Sources/Dominoes/Dominoes.swift" 18 | ], 19 | "test": [ 20 | "Tests/DominoesTests/DominoesTests.swift" 21 | ], 22 | "example": [ 23 | ".meta/Sources/Dominoes/DominoesExample.swift" 24 | ] 25 | }, 26 | "blurb": "Make a chain of dominoes." 27 | } 28 | -------------------------------------------------------------------------------- /exercises/practice/dominoes/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Dominoes", 7 | products: [ 8 | .library( 9 | name: "Dominoes", 10 | targets: ["Dominoes"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Dominoes", 16 | dependencies: []), 17 | .testTarget( 18 | name: "DominoesTests", 19 | dependencies: ["Dominoes"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/dominoes/Sources/Dominoes/Dominoes.swift: -------------------------------------------------------------------------------- 1 | struct Dominoes { 2 | // Write your code for the 'Dominoes' exercise here. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/etl/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/etl/.meta/Sources/Etl/EtlExample.swift: -------------------------------------------------------------------------------- 1 | struct ETL { 2 | static func transform(_ old: [String: [String]]) -> [String: Int] { 3 | var result = [String: Int]() 4 | for (score, letters) in old { 5 | for letter in letters { 6 | result[letter.lowercased()] = Int(score) 7 | } 8 | } 9 | return result 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/etl/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Etl", 7 | products: [ 8 | .library( 9 | name: "Etl", 10 | targets: ["Etl"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Etl", 16 | dependencies: []), 17 | .testTarget( 18 | name: "EtlTests", 19 | dependencies: ["Etl"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/etl/Sources/Etl/Etl.swift: -------------------------------------------------------------------------------- 1 | class ETL { 2 | static func transform(_ old: [String: [String]]) -> [String: Int] { 3 | // Write your code for the 'Etl' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/flatten-array/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Take a nested list and return a single flattened list with all values except nil/null. 4 | 5 | The challenge is to take an arbitrarily-deep nested list-like structure and produce a flattened structure without any nil/null values. 6 | 7 | For example: 8 | 9 | input: [1,[2,3,null,4],[null],5] 10 | 11 | output: [1,2,3,4,5] 12 | -------------------------------------------------------------------------------- /exercises/practice/flatten-array/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/flatten-array/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "FlattenArray", 7 | products: [ 8 | .library( 9 | name: "FlattenArray", 10 | targets: ["FlattenArray"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "FlattenArray", 16 | dependencies: []), 17 | .testTarget( 18 | name: "FlattenArrayTests", 19 | dependencies: ["FlattenArray"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/flatten-array/Sources/FlattenArray/FlattenArray.swift: -------------------------------------------------------------------------------- 1 | // // Write your code for the 'Flatten-Array' exercise in this file. -------------------------------------------------------------------------------- /exercises/practice/food-chain/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/food-chain/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "FoodChain", 7 | products: [ 8 | .library( 9 | name: "FoodChain", 10 | targets: ["FoodChain"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "FoodChain", 16 | dependencies: []), 17 | .testTarget( 18 | name: "FoodChainTests", 19 | dependencies: ["FoodChain"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/food-chain/Sources/FoodChain/FoodChain.swift: -------------------------------------------------------------------------------- 1 | struct FoodChain { 2 | static func song(start: Int, end: Int) -> String { 3 | // Write your code for the 'Food Chain' exercise here. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.docs/hints.md: -------------------------------------------------------------------------------- 1 | # Hints 2 | 3 | - You can import `Foundation` for time and date functions 4 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to determine the date and time one gigasecond after a certain date. 4 | 5 | A gigasecond is one thousand million seconds. 6 | That is a one with nine zeros after it. 7 | 8 | If you were born on _January 24th, 2015 at 22:00 (10:00:00pm)_, then you would be a gigasecond old on _October 2nd, 2046 at 23:46:40 (11:46:40pm)_. 9 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.meta/Sources/Gigasecond/GigasecondExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func gigasecond(from: Date) -> Date { 4 | return from.addingTimeInterval(1_000_000_000) 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Gigasecond", 7 | products: [ 8 | .library( 9 | name: "Gigasecond", 10 | targets: ["Gigasecond"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Gigasecond", 16 | dependencies: []), 17 | .testTarget( 18 | name: "GigasecondTests", 19 | dependencies: ["Gigasecond"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/Sources/Gigasecond/Gigasecond.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func gigasecond(from: Date) -> Date { 4 | // Write your code for the 'Gigasecond' exercise in this file. 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/.meta/Sources/GradeSchool/GradeSchoolExample.swift: -------------------------------------------------------------------------------- 1 | class GradeSchool { 2 | var rosters = [Int: [String]]() 3 | 4 | func addStudent(_ name: String, grade: Int) -> Bool { 5 | if rosters.values.contains { $0.contains(name) } { 6 | return false 7 | } 8 | rosters[grade, default: []].append(name) 9 | return true 10 | } 11 | 12 | func studentsInGrade(_ grade: Int) -> [String] { 13 | return (rosters[grade] ?? [String]()).sorted() 14 | } 15 | 16 | func roster() -> [String] { 17 | return rosters.keys.sorted().flatMap { (rosters[$0] ?? [String]()).sorted() } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "GradeSchool", 7 | products: [ 8 | .library( 9 | name: "GradeSchool", 10 | targets: ["GradeSchool"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "GradeSchool", 16 | dependencies: []), 17 | .testTarget( 18 | name: "GradeSchoolTests", 19 | dependencies: ["GradeSchool"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/Sources/GradeSchool/GradeSchool.swift: -------------------------------------------------------------------------------- 1 | class GradeSchool { 2 | // Write your code for the 'GradeSchool' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/grains/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/grains/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Grains", 7 | products: [ 8 | .library( 9 | name: "Grains", 10 | targets: ["Grains"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Grains", 16 | dependencies: []), 17 | .testTarget( 18 | name: "GrainsTests", 19 | dependencies: ["Grains"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/grains/Sources/Grains/Grains.swift: -------------------------------------------------------------------------------- 1 | struct Grains { 2 | static func square(_ num: Int) throws -> UInt64 { 3 | // Write your code for the 'Grains' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Calculate the Hamming distance between two DNA strands. 4 | 5 | We read DNA using the letters C, A, G and T. 6 | Two strands might look like this: 7 | 8 | GAGCCTACTAACGGGAT 9 | CATCGTAATGACGGCCT 10 | ^ ^ ^ ^ ^ ^^ 11 | 12 | They have 7 differences, and therefore the Hamming distance is 7. 13 | 14 | ## Implementation notes 15 | 16 | The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work. 17 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.meta/Sources/Hamming/HammingExample.swift: -------------------------------------------------------------------------------- 1 | enum HammingError: Error { 2 | case differentLength 3 | } 4 | 5 | func compute(_ dnaSequence: String, against: String) throws -> Int? { 6 | guard dnaSequence.count == against.count else { 7 | throw HammingError.differentLength 8 | } 9 | let distance: Int = zip(dnaSequence, against).filter({ $0 != $1 }).count 10 | return distance 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/hamming/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Hamming", 7 | products: [ 8 | .library( 9 | name: "Hamming", 10 | targets: ["Hamming"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Hamming", 16 | dependencies: []), 17 | .testTarget( 18 | name: "HammingTests", 19 | dependencies: ["Hamming"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/hamming/Sources/Hamming/Hamming.swift: -------------------------------------------------------------------------------- 1 | func compute(_ dnaSequence: String, against: String) throws -> Int? { 2 | // Write your code for the 'Hamming' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/Sources/HelloWorld/HelloWorldExample.swift: -------------------------------------------------------------------------------- 1 | func hello() -> String { 2 | return "Hello, World!" 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "HelloWorld", 7 | products: [ 8 | .library( 9 | name: "HelloWorld", 10 | targets: ["HelloWorld"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "HelloWorld", 16 | dependencies: []), 17 | .testTarget( 18 | name: "HelloWorldTests", 19 | dependencies: ["HelloWorld"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/Sources/HelloWorld/HelloWorld.swift: -------------------------------------------------------------------------------- 1 | func hello() -> String { 2 | return "Goodbye, Mars!" 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/Tests/HelloWorldTests/HelloWorldTests.swift: -------------------------------------------------------------------------------- 1 | import Testing 2 | 3 | @testable import HelloWorld 4 | 5 | @Test("Hello, World!") 6 | func testHello() { 7 | #expect(hello() == "Hello, World!") 8 | } 9 | -------------------------------------------------------------------------------- /exercises/practice/hexadecimal/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Convert a hexadecimal number, represented as a string (e.g. "10af8c"), to its decimal equivalent using first principles (i.e. no, you may not use built-in or external libraries to accomplish the conversion). 4 | 5 | On the web we use hexadecimal to represent colors, e.g. green: 008000, 6 | teal: 008080, navy: 000080). 7 | 8 | The program should handle invalid hexadecimal strings. 9 | -------------------------------------------------------------------------------- /exercises/practice/hexadecimal/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/hexadecimal/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Hexadecimal", 7 | products: [ 8 | .library( 9 | name: "Hexadecimal", 10 | targets: ["Hexadecimal"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Hexadecimal", 16 | dependencies: []), 17 | .testTarget( 18 | name: "HexadecimalTests", 19 | dependencies: ["Hexadecimal"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/hexadecimal/Sources/Hexadecimal/Hexadecimal.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/house/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/house/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "House", 7 | products: [ 8 | .library( 9 | name: "House", 10 | targets: ["House"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "House", 16 | dependencies: []), 17 | .testTarget( 18 | name: "HouseTests", 19 | dependencies: ["House"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/house/Sources/House/House.swift: -------------------------------------------------------------------------------- 1 | class House { 2 | static func recite(start: Int, end: Int) -> String { 3 | // Write your code for the 'House' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/isbn-verifier/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/isbn-verifier/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "IsbnVerifier", 7 | products: [ 8 | .library( 9 | name: "IsbnVerifier", 10 | targets: ["IsbnVerifier"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "IsbnVerifier", 16 | dependencies: []), 17 | .testTarget( 18 | name: "IsbnVerifierTests", 19 | dependencies: ["IsbnVerifier"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/isbn-verifier/Sources/IsbnVerifier/IsbnVerifier.swift: -------------------------------------------------------------------------------- 1 | class IsbnVerifier { 2 | static func isValid(_ string: String) -> Bool { 3 | // Write your code for the 'IsbnVerifier' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Determine if a word or phrase is an isogram. 4 | 5 | An isogram (also known as a "non-pattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. 6 | 7 | Examples of isograms: 8 | 9 | - lumberjacks 10 | - background 11 | - downstream 12 | - six-year-old 13 | 14 | The word _isograms_, however, is not an isogram, because the s repeats. 15 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.meta/Sources/Isogram/IsogramExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func isIsogram(_ string: String) -> Bool { 4 | let lowercasedString = string.lowercased() 5 | let lowercaseLetterSet = CharacterSet.lowercaseLetters 6 | 7 | var letters: Set = [] 8 | 9 | for character in lowercasedString.unicodeScalars { 10 | guard lowercaseLetterSet.contains(character) else { 11 | continue 12 | } 13 | 14 | guard !letters.contains(character) else { 15 | return false 16 | } 17 | 18 | letters.insert(character) 19 | } 20 | 21 | return true 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/isogram/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Isogram", 7 | products: [ 8 | .library( 9 | name: "Isogram", 10 | targets: ["Isogram"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Isogram", 16 | dependencies: []), 17 | .testTarget( 18 | name: "IsogramTests", 19 | dependencies: ["Isogram"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/isogram/Sources/Isogram/Isogram.swift: -------------------------------------------------------------------------------- 1 | func isIsogram(_ string: String) -> Bool { 2 | // Write your code for the 'Isogram' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | The kindergarten class is learning about growing plants. 4 | The teacher thought it would be a good idea to give the class seeds to plant and grow in the dirt. 5 | To this end, the children have put little cups along the window sills and planted one type of plant in each cup. 6 | The children got to pick their favorites from four available types of seeds: grass, clover, radishes, and violets. 7 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "KindergartenGarden", 7 | products: [ 8 | .library( 9 | name: "KindergartenGarden", 10 | targets: ["KindergartenGarden"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "KindergartenGarden", 16 | dependencies: []), 17 | .testTarget( 18 | name: "KindergartenGardenTests", 19 | dependencies: ["KindergartenGarden"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/Sources/KindergartenGarden/KindergartenGarden.swift: -------------------------------------------------------------------------------- 1 | class Garden { 2 | // Write your code for the 'KindergartenGarden' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | ## Item representation 2 | 3 | The items are represented by the `Item` struct in `Item.swift`. -------------------------------------------------------------------------------- /exercises/practice/knapsack/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Bob is a thief. 4 | After months of careful planning, he finally manages to crack the security systems of a fancy store. 5 | 6 | In front of him are many items, each with a value and weight. 7 | Bob would gladly take all of the items, but his knapsack can only hold so much weight. 8 | Bob has to carefully consider which items to take so that the total value of his selection is maximized. 9 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/.meta/Sources/Knapsack/Item.swift: -------------------------------------------------------------------------------- 1 | // Represents an item in knapsack. 2 | // There is be no need to edit this file and changes to this file are ignored by the Exercism test runners. 3 | 4 | struct Item { 5 | let weight: Int 6 | let value: Int 7 | } -------------------------------------------------------------------------------- /exercises/practice/knapsack/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Knapsack", 7 | products: [ 8 | .library( 9 | name: "Knapsack", 10 | targets: ["Knapsack"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Knapsack", 16 | dependencies: []), 17 | .testTarget( 18 | name: "KnapsackTests", 19 | dependencies: ["Knapsack"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/Sources/Knapsack/Item.swift: -------------------------------------------------------------------------------- 1 | // Represents an item in knapsack. 2 | // There is be no need to edit this file and changes to this file are ignored by the Exercism test runners. 3 | 4 | struct Item { 5 | let weight: Int 6 | let value: Int 7 | } -------------------------------------------------------------------------------- /exercises/practice/knapsack/Sources/Knapsack/Knapsack.swift: -------------------------------------------------------------------------------- 1 | struct Knapsack { 2 | // Write your code for the 'Knapsack' exercise in this file. 3 | } -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a government agency that has intercepted a series of encrypted communication signals from a group of bank robbers. 4 | The signals contain a long sequence of digits. 5 | Your team needs to use various digital signal processing techniques to analyze the signals and identify any patterns that may indicate the planning of a heist. 6 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "LargestSeriesProduct", 7 | products: [ 8 | .library( 9 | name: "LargestSeriesProduct", 10 | targets: ["LargestSeriesProduct"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "LargestSeriesProduct", 16 | dependencies: []), 17 | .testTarget( 18 | name: "LargestSeriesProductTests", 19 | dependencies: ["LargestSeriesProduct"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/Sources/LargestSeriesProduct/LargestSeriesProduct.swift: -------------------------------------------------------------------------------- 1 | class NumberSeries { 2 | // Write your code for the 'LargestSeriesProduct' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/leap/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to determine whether a given year is a leap year. 4 | -------------------------------------------------------------------------------- /exercises/practice/leap/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/leap/.meta/Sources/Leap/LeapExample.swift: -------------------------------------------------------------------------------- 1 | struct Year { 2 | var year = 1900 3 | init(calendarYear: Int) { 4 | year = calendarYear 5 | } 6 | var isLeapYear: Bool { 7 | return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /exercises/practice/leap/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Leap", 7 | products: [ 8 | .library( 9 | name: "Leap", 10 | targets: ["Leap"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Leap", 16 | dependencies: []), 17 | .testTarget( 18 | name: "LeapTests", 19 | dependencies: ["Leap"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/leap/Sources/Leap/Leap.swift: -------------------------------------------------------------------------------- 1 | class Year { 2 | // Write your code for the 'Leap' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/linked-list/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You are working on a project to develop a train scheduling system for a busy railway network. 4 | 5 | You've been asked to develop a prototype for the train routes in the scheduling system. 6 | Each route consists of a sequence of train stations that a given train stops at. 7 | -------------------------------------------------------------------------------- /exercises/practice/linked-list/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/linked-list/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "LinkedList", 7 | products: [ 8 | .library( 9 | name: "LinkedList", 10 | targets: ["LinkedList"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "LinkedList", 16 | dependencies: []), 17 | .testTarget( 18 | name: "LinkedListTests", 19 | dependencies: ["LinkedList"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/linked-list/Sources/LinkedList/LinkedList.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "robtimp" 4 | ], 5 | "contributors": [ 6 | "bcylin", 7 | "bhargavg", 8 | "kytrinyx", 9 | "masters3d", 10 | "ThomasHaz" 11 | ], 12 | "files": { 13 | "solution": [ 14 | "Sources/ListOps/ListOps.swift" 15 | ], 16 | "test": [ 17 | "Tests/ListOpsTests/ListOpsTests.swift" 18 | ], 19 | "example": [ 20 | ".meta/Sources/ListOps/ListOpsExample.swift" 21 | ] 22 | }, 23 | "blurb": "Implement basic list operations." 24 | } 25 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ListOps", 7 | products: [ 8 | .library( 9 | name: "ListOps", 10 | targets: ["ListOps"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "ListOps", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ListOpsTests", 19 | dependencies: ["ListOps"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/list-ops/Sources/ListOps/ListOps.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/luhn/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/luhn/.meta/Sources/Luhn/LuhnExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func isValidLuhn(_ number: String) -> Bool { 4 | var number = number 5 | var sum = 0 6 | var odd = true 7 | number = number.replacingOccurrences(of:" ", with: "") 8 | guard number.count > 1 else { return false } 9 | for char in number.reversed() { 10 | if let digit = Int(String(char)) { 11 | sum += odd ? digit : digit < 5 ? digit * 2 : digit * 2 - 9 12 | odd.toggle() 13 | } else { 14 | return false 15 | } 16 | } 17 | return sum % 10 == 0 18 | } 19 | -------------------------------------------------------------------------------- /exercises/practice/luhn/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Luhn", 7 | products: [ 8 | .library( 9 | name: "Luhn", 10 | targets: ["Luhn"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Luhn", 16 | dependencies: []), 17 | .testTarget( 18 | name: "LuhnTests", 19 | dependencies: ["Luhn"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/luhn/Sources/Luhn/Luhn.swift: -------------------------------------------------------------------------------- 1 | func isValidLuhn(_ number: String) -> Bool { 2 | // Write your code for the 'Luhn' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a string containing brackets `[]`, braces `{}`, parentheses `()`, or any combination thereof, verify that any and all pairs are matched and nested correctly. 4 | Any other characters should be ignored. 5 | For example, `"{what is (42)}?"` is balanced and `"[text}"` is not. 6 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "MatchingBrackets", 7 | products: [ 8 | .library( 9 | name: "MatchingBrackets", 10 | targets: ["MatchingBrackets"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "MatchingBrackets", 16 | dependencies: []), 17 | .testTarget( 18 | name: "MatchingBracketsTests", 19 | dependencies: ["MatchingBrackets"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/Sources/MatchingBrackets/MatchingBrackets.swift: -------------------------------------------------------------------------------- 1 | class MatchingBrackets { 2 | static func paired(text: String) -> Bool { 3 | // Write your code for the 'MatchingBrackets' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/matrix/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/matrix/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Matrix", 7 | products: [ 8 | .library( 9 | name: "Matrix", 10 | targets: ["Matrix"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Matrix", 16 | dependencies: []), 17 | .testTarget( 18 | name: "MatrixTests", 19 | dependencies: ["Matrix"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/matrix/Sources/Matrix/Matrix.swift: -------------------------------------------------------------------------------- 1 | struct Matrix { 2 | // Write your code for the 'Matrix' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/meetup/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/meetup/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Meetup", 7 | products: [ 8 | .library( 9 | name: "Meetup", 10 | targets: ["Meetup"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Meetup", 16 | dependencies: []), 17 | .testTarget( 18 | name: "MeetupTests", 19 | dependencies: ["Meetup"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/meetup/Sources/Meetup/Meetup.swift: -------------------------------------------------------------------------------- 1 | class Meetup { 2 | // Write your code for the 'Meetup' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | [Minesweeper][wikipedia] is a popular game where the user has to find the mines using numeric hints that indicate how many mines are directly adjacent (horizontally, vertically, diagonally) to a square. 4 | 5 | [wikipedia]: https://en.wikipedia.org/wiki/Minesweeper_(video_game) 6 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [], 3 | "contributors": [ 4 | "bhargavg", 5 | "harquail", 6 | "lyuha", 7 | "masters3d", 8 | "robtimp", 9 | "ThomasHaz", 10 | "meatball133" 11 | ], 12 | "files": { 13 | "solution": [ 14 | "Sources/Minesweeper/Minesweeper.swift" 15 | ], 16 | "test": [ 17 | "Tests/MinesweeperTests/MinesweeperTests.swift" 18 | ], 19 | "example": [ 20 | ".meta/Sources/Minesweeper/MinesweeperExample.swift" 21 | ] 22 | }, 23 | "blurb": "Add the numbers to a minesweeper board." 24 | } 25 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Minesweeper", 7 | products: [ 8 | .library( 9 | name: "Minesweeper", 10 | targets: ["Minesweeper"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Minesweeper", 16 | dependencies: []), 17 | .testTarget( 18 | name: "MinesweeperTests", 19 | dependencies: ["Minesweeper"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/Sources/Minesweeper/Minesweeper.swift: -------------------------------------------------------------------------------- 1 | class Board { 2 | // Write your code for the 'Minesweeper' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a number n, determine what the nth prime is. 4 | 5 | By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. 6 | 7 | If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself. 8 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.meta/Sources/NthPrime/NthPrimeExample.swift: -------------------------------------------------------------------------------- 1 | enum PrimeError: Error { 2 | case noZerothPrime 3 | } 4 | 5 | func nthPrime(_ n: Int) throws -> Int { 6 | guard n > 0 else { throw PrimeError.noZerothPrime } 7 | var primes = [2] 8 | var candidate = 3 9 | while primes.count < n { 10 | if primes.allSatisfy({ candidate % $0 != 0 }) { 11 | primes.append(candidate) 12 | } 13 | candidate += 2 14 | } 15 | return primes.last! 16 | } 17 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "NthPrime", 7 | products: [ 8 | .library( 9 | name: "NthPrime", 10 | targets: ["NthPrime"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "NthPrime", 16 | dependencies: []), 17 | .testTarget( 18 | name: "NthPrimeTests", 19 | dependencies: ["NthPrime"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/Sources/NthPrime/NthPrime.swift: -------------------------------------------------------------------------------- 1 | func nthPrime(_ n: Int) throws -> Int { 2 | // Write your code for the 'NthPrime' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "NucleotideCount", 7 | products: [ 8 | .library( 9 | name: "NucleotideCount", 10 | targets: ["NucleotideCount"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "NucleotideCount", 16 | dependencies: []), 17 | .testTarget( 18 | name: "NucleotideCountTests", 19 | dependencies: ["NucleotideCount"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/nucleotide-count/Sources/NucleotideCount/NucleotideCount.swift: -------------------------------------------------------------------------------- 1 | class DNA { 2 | // Write your code for the 'NucleotideCount' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/ocr-numbers/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/ocr-numbers/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "OcrNumbers", 7 | products: [ 8 | .library( 9 | name: "OcrNumbers", 10 | targets: ["OcrNumbers"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "OcrNumbers", 16 | dependencies: []), 17 | .testTarget( 18 | name: "OcrNumbersTests", 19 | dependencies: ["OcrNumbers"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/ocr-numbers/Sources/OcrNumbers/OcrNumbers.swift: -------------------------------------------------------------------------------- 1 | class OcrNumber { 2 | static func convert(rows: [String]) throws -> String { 3 | // Write your code for the 'OcrNumbers' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/octal/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/octal/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Octal", 7 | products: [ 8 | .library( 9 | name: "Octal", 10 | targets: ["Octal"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Octal", 16 | dependencies: []), 17 | .testTarget( 18 | name: "OctalTests", 19 | dependencies: ["Octal"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/octal/Sources/Octal/Octal.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "PalindromeProducts", 7 | products: [ 8 | .library( 9 | name: "PalindromeProducts", 10 | targets: ["PalindromeProducts"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "PalindromeProducts", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PalindromeProductsTests", 19 | dependencies: ["PalindromeProducts"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/Sources/PalindromeProducts/PalindromeProducts.swift: -------------------------------------------------------------------------------- 1 | class PalindromeProducts { 2 | // Write your code for the 'PalindromeProducts' exercise in this file. 3 | 4 | static func largest(from: Int, to: Int) throws -> (value: Int?, factors: Set<[Int]>) { 5 | } 6 | 7 | static func smallest(from: Int, to: Int) throws -> (value: Int?, factors: Set<[Int]>) { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to figure out if a sentence is a pangram. 4 | 5 | A pangram is a sentence using every letter of the alphabet at least once. 6 | It is case insensitive, so it doesn't matter if a letter is lower-case (e.g. `k`) or upper-case (e.g. `K`). 7 | 8 | For this exercise, a sentence is a pangram if it contains each of the 26 letters in the English alphabet. 9 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.meta/Sources/Pangram/PangramExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func isPangram(_ text: String) -> Bool { 4 | let lowercasedText = text.folding(options: .diacriticInsensitive, locale: .current).lowercased() 5 | 6 | for letter in "abcdefghijklmnopqrstuvwxyz" { 7 | if lowercasedText.contains(String(letter)) == false { 8 | return false 9 | } 10 | } 11 | 12 | return true 13 | } 14 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [], 3 | "contributors": [ 4 | "bhargavg", 5 | "harquail", 6 | "kytrinyx", 7 | "lyuha", 8 | "masters3d", 9 | "ThomasHaz" 10 | ], 11 | "files": { 12 | "solution": [ 13 | "Sources/Pangram/Pangram.swift" 14 | ], 15 | "test": [ 16 | "Tests/PangramTests/PangramTests.swift" 17 | ], 18 | "example": [ 19 | ".meta/Sources/Pangram/PangramExample.swift" 20 | ] 21 | }, 22 | "blurb": "Determine if a sentence is a pangram.", 23 | "source": "Wikipedia", 24 | "source_url": "https://en.wikipedia.org/wiki/Pangram" 25 | } 26 | -------------------------------------------------------------------------------- /exercises/practice/pangram/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Pangram", 7 | products: [ 8 | .library( 9 | name: "Pangram", 10 | targets: ["Pangram"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Pangram", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PangramTests", 19 | dependencies: ["Pangram"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/pangram/Sources/Pangram/Pangram.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func isPangram(_ text: String) -> Bool { 4 | // Write your code for the 'Pangram' exercise in this file. 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/.meta/Sources/PascalsTriangle/PascalsTriangleExample.swift: -------------------------------------------------------------------------------- 1 | func pascalsTriangle(rows: Int) -> [[Int]] { 2 | var triangle = [[Int]]() 3 | 4 | for row in 0.. [[Int]] { 2 | // Write your code for the 'PascalsTriangle' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "PerfectNumbers", 7 | products: [ 8 | .library( 9 | name: "PerfectNumbers", 10 | targets: ["PerfectNumbers"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "PerfectNumbers", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PerfectNumbersTests", 19 | dependencies: ["PerfectNumbers"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/Sources/PerfectNumbers/PerfectNumbers.swift: -------------------------------------------------------------------------------- 1 | enum Classification { 2 | case perfect 3 | case abundant 4 | case deficient 5 | } 6 | 7 | func classify(number: Int) throws -> Classification { 8 | // Write your code for the 'Perfect Numbers' exercise in this file. 9 | } 10 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "PhoneNumber", 7 | products: [ 8 | .library( 9 | name: "PhoneNumber", 10 | targets: ["PhoneNumber"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "PhoneNumber", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PhoneNumberTests", 19 | dependencies: ["PhoneNumber"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/Sources/PhoneNumber/PhoneNumber.swift: -------------------------------------------------------------------------------- 1 | class PhoneNumber { 2 | // Write your code for the 'PhoneNumber' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Your parents have challenged you and your sibling to a game of two-on-two basketball. 4 | Confident they'll win, they let you score the first couple of points, but then start taking over the game. 5 | Needing a little boost, you start speaking in [Pig Latin][pig-latin], which is a made-up children's language that's difficult for non-children to understand. 6 | This will give you the edge to prevail over your parents! 7 | 8 | [pig-latin]: https://en.wikipedia.org/wiki/Pig_latin 9 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "PigLatin", 7 | products: [ 8 | .library( 9 | name: "PigLatin", 10 | targets: ["PigLatin"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "PigLatin", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PigLatinTests", 19 | dependencies: ["PigLatin"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/Sources/PigLatin/PigLatin.swift: -------------------------------------------------------------------------------- 1 | class PigLatin { 2 | static func translate(_ input: String) -> String { 3 | // Write your code for the 'PigLatin' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/poker/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Pick the best hand(s) from a list of poker hands. 4 | 5 | See [Wikipedia][poker-hands] for an overview of poker hands. 6 | 7 | [poker-hands]: https://en.wikipedia.org/wiki/List_of_poker_hands 8 | -------------------------------------------------------------------------------- /exercises/practice/poker/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/poker/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Poker", 7 | products: [ 8 | .library( 9 | name: "Poker", 10 | targets: ["Poker"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Poker", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PokerTests", 19 | dependencies: ["Poker"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/poker/Sources/Poker/Poker.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/prime-factors/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/prime-factors/.meta/Sources/PrimeFactors/PrimeFactorsExample.swift: -------------------------------------------------------------------------------- 1 | func primeFactors(_ number: Int64) -> [Int64] { 2 | var number = number 3 | var primes = [Int64]() 4 | var divisor: Int64 = 2 5 | 6 | while number > 1 { 7 | while number % divisor == 0 { 8 | primes.append(divisor) 9 | number /= divisor 10 | } 11 | divisor += 1 12 | } 13 | return primes 14 | } 15 | -------------------------------------------------------------------------------- /exercises/practice/prime-factors/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "PrimeFactors", 7 | products: [ 8 | .library( 9 | name: "PrimeFactors", 10 | targets: ["PrimeFactors"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "PrimeFactors", 16 | dependencies: []), 17 | .testTarget( 18 | name: "PrimeFactorsTests", 19 | dependencies: ["PrimeFactors"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/prime-factors/Sources/PrimeFactors/PrimeFactors.swift: -------------------------------------------------------------------------------- 1 | func primeFactors(_ number: Int64) -> [Int64] { 2 | // Write your code for the 'PrimeFactors' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ProteinTranslation", 7 | products: [ 8 | .library( 9 | name: "ProteinTranslation", 10 | targets: ["ProteinTranslation"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "ProteinTranslation", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ProteinTranslationTests", 19 | dependencies: ["ProteinTranslation"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/Sources/ProteinTranslation/ProteinTranslation.swift: -------------------------------------------------------------------------------- 1 | func translationOfRNA(rna strand: String) throws -> [String] { 2 | // Write your code for the 'Protein Translation' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/proverb/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/proverb/.meta/Sources/Proverb/ProverbExample.swift: -------------------------------------------------------------------------------- 1 | class Proverb { 2 | let words: [String] 3 | 4 | init(_ words: [String]) { 5 | self.words = words 6 | } 7 | 8 | func recite() -> String { 9 | var result = "" 10 | for i in 0.. [[Int]] { 2 | var result: [[Int]] = [] 3 | 4 | for a in 1.. [[Int]] { 2 | // Write your code for the 'Pythagorean Triplet' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "QueenAttack", 7 | products: [ 8 | .library( 9 | name: "QueenAttack", 10 | targets: ["QueenAttack"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "QueenAttack", 16 | dependencies: []), 17 | .testTarget( 18 | name: "QueenAttackTests", 19 | dependencies: ["QueenAttack"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/Sources/QueenAttack/QueenAttack.swift: -------------------------------------------------------------------------------- 1 | class Queen { 2 | // Write your code for the 'Queen Attack' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question. 4 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.meta/Sources/Raindrops/RaindropsExample.swift: -------------------------------------------------------------------------------- 1 | func raindrops(_ number: Int) -> String { 2 | let result = (number % 3, number % 5, number % 7) 3 | switch result { 4 | case (0, 0, 0): return "PlingPlangPlong" 5 | case (_, 0, 0): return "PlangPlong" 6 | case (0, _, 0): return "PlingPlong" 7 | case (0, 0, _): return "PlingPlang" 8 | case (_, _, 0): return "Plong" 9 | case (_, 0, _): return "Plang" 10 | case (0, _, _): return "Pling" 11 | default: return "\(number)" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Raindrops", 7 | products: [ 8 | .library( 9 | name: "Raindrops", 10 | targets: ["Raindrops"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Raindrops", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RaindropsTests", 19 | dependencies: ["Raindrops"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/Sources/Raindrops/Raindrops.swift: -------------------------------------------------------------------------------- 1 | func raindrops(_ number: Int) -> String { 2 | // Write your code for the 'Raindrops' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to reverse a given string. 4 | 5 | Some examples: 6 | 7 | - Turn `"stressed"` into `"desserts"`. 8 | - Turn `"strops"` into `"sports"`. 9 | - Turn `"racecar"` into `"racecar"`. 10 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming. 4 | 5 | For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance. 6 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.meta/Sources/ReverseString/ReverseStringExample.swift: -------------------------------------------------------------------------------- 1 | func reverseString(_ input : String) -> String { 2 | return String(input.reversed()) 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ReverseString", 7 | products: [ 8 | .library( 9 | name: "ReverseString", 10 | targets: ["ReverseString"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "ReverseString", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ReverseStringTests", 19 | dependencies: ["ReverseString"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/Sources/ReverseString/ReverseString.swift: -------------------------------------------------------------------------------- 1 | func reverseString(_ input : String) -> String { 2 | // Write your code for the 'Reverse String' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.meta/Sources/RnaTranscription/RnaTranscriptionExample.swift: -------------------------------------------------------------------------------- 1 | func toRna(_ dna: String) -> String { 2 | var rna = "" 3 | 4 | for nucleotide in dna { 5 | switch nucleotide { 6 | case "G": 7 | rna += "C" 8 | case "C": 9 | rna += "G" 10 | case "T": 11 | rna += "A" 12 | case "A": 13 | rna += "U" 14 | default: 15 | continue 16 | } 17 | } 18 | return rna 19 | } 20 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RnaTranscription", 7 | products: [ 8 | .library( 9 | name: "RnaTranscription", 10 | targets: ["RnaTranscription"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "RnaTranscription", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RnaTranscriptionTests", 19 | dependencies: ["RnaTranscription"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/Sources/RnaTranscription/RnaTranscription.swift: -------------------------------------------------------------------------------- 1 | func toRna(_ dna: String) -> String { 2 | // Write your code for the 'Rna Transcription' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/robot-name/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/robot-name/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RobotName", 7 | products: [ 8 | .library( 9 | name: "RobotName", 10 | targets: ["RobotName"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "RobotName", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RobotNameTests", 19 | dependencies: ["RobotName"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/robot-name/Sources/RobotName/RobotName.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [], 3 | "contributors": [ 4 | "bhargavg", 5 | "harquail", 6 | "lyuha", 7 | "masters3d", 8 | "ThomasHaz" 9 | ], 10 | "files": { 11 | "solution": [ 12 | "Sources/RobotSimulator/RobotSimulator.swift" 13 | ], 14 | "test": [ 15 | "Tests/RobotSimulatorTests/RobotSimulatorTests.swift" 16 | ], 17 | "example": [ 18 | ".meta/Sources/RobotSimulator/RobotSimulatorExample.swift" 19 | ] 20 | }, 21 | "blurb": "Write a robot simulator.", 22 | "source": "Inspired by an interview question at a famous company." 23 | } 24 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RobotSimulator", 7 | products: [ 8 | .library( 9 | name: "RobotSimulator", 10 | targets: ["RobotSimulator"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "RobotSimulator", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RobotSimulatorTests", 19 | dependencies: ["RobotSimulator"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/Sources/RobotSimulator/RobotSimulator.swift: -------------------------------------------------------------------------------- 1 | class SimulatedRobot { 2 | // Write your code for the 'RobotSimulator' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | ## Adding method to the Int structure 2 | 3 | This exercise focuses on adding methods to the `Int` structure in Swift. 4 | This is easiest done through using [extensions][extensions]. 5 | 6 | ```swift 7 | extension Int { 8 | // 9 | } 10 | ``` 11 | 12 | The `Int` documentation can be found [here][int]. 13 | 14 | [int]: https://developer.apple.com/documentation/swift/int 15 | [extensions]: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/extensions/ 16 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.meta/Sources/RomanNumerals/RomanNumeralsExample.swift: -------------------------------------------------------------------------------- 1 | extension Int { 2 | func toRomanNumeral() -> String { 3 | var arabicToRoman = [1000: "M", 900: "CM", 500: "D", 400: "CD", 100: "C", 90: "XC", 50: "L", 40: "XL", 10: "X", 9: "IX", 5: "V", 4: "IV", 1: "I"] 4 | var i = self 5 | var s = "" 6 | for arabic in arabicToRoman.keys.sorted(by: > ) { 7 | while i >= arabic { 8 | s += arabicToRoman[arabic] ?? "" 9 | i -= arabic 10 | } 11 | } 12 | return s 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RomanNumerals", 7 | products: [ 8 | .library( 9 | name: "RomanNumerals", 10 | targets: ["RomanNumerals"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "RomanNumerals", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RomanNumeralsTests", 19 | dependencies: ["RomanNumerals"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/Sources/RomanNumerals/RomanNumerals.swift: -------------------------------------------------------------------------------- 1 | extension Int { 2 | // Write your code for the 'RomanNumerals' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RotationalCipher", 7 | products: [ 8 | .library( 9 | name: "RotationalCipher", 10 | targets: ["RotationalCipher"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "RotationalCipher", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RotationalCipherTests", 19 | dependencies: ["RotationalCipher"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/Sources/RotationalCipher/RotationalCipher.swift: -------------------------------------------------------------------------------- 1 | func rotateCipher(_ input: String, shift: Int) -> String { 2 | // Write your code for the 'Rotational Cipher' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/run-length-encoding/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/run-length-encoding/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RunLengthEncoding", 7 | products: [ 8 | .library( 9 | name: "RunLengthEncoding", 10 | targets: ["RunLengthEncoding"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "RunLengthEncoding", 16 | dependencies: []), 17 | .testTarget( 18 | name: "RunLengthEncodingTests", 19 | dependencies: ["RunLengthEncoding"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/run-length-encoding/Sources/RunLengthEncoding/RunLengthEncoding.swift: -------------------------------------------------------------------------------- 1 | class RunLengthEncoding { 2 | // Write your code for the 'RunLengthEncoding' exercise in this file. 3 | static func encode(_ phrase : String) -> String{ 4 | } 5 | 6 | static func decode(_ phrase : String) -> String{ 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You plan to build a tree house in the woods near your house so that you can watch the sun rise and set. 4 | 5 | You've obtained data from a local survey company that show the height of every tree in each rectangular section of the map. 6 | You need to analyze each grid on the map to find good trees for your tree house. 7 | 8 | A good tree is both: 9 | 10 | - taller than every tree to the east and west, so that you have the best possible view of the sunrises and sunsets. 11 | - shorter than every tree to the north and south, to minimize the amount of tree climbing. 12 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/.meta/Sources/SaddlePoints/Position.swift: -------------------------------------------------------------------------------- 1 | struct Position: Equatable { 2 | let row: Int 3 | let column: Int 4 | 5 | static func == (lhs: Position, rhs: Position) -> Bool { 6 | return lhs.row == rhs.row && lhs.column == rhs.column 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "SaddlePoints", 7 | products: [ 8 | .library( 9 | name: "SaddlePoints", 10 | targets: ["SaddlePoints"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "SaddlePoints", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SaddlePointsTests", 19 | dependencies: ["SaddlePoints"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/Sources/SaddlePoints/Position.swift: -------------------------------------------------------------------------------- 1 | struct Position : Equatable { 2 | let row: Int 3 | let column: Int 4 | 5 | static func ==(lhs: Position, rhs: Position) -> Bool { 6 | return lhs.row == rhs.row && lhs.column == rhs.column 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/Sources/SaddlePoints/SaddlePoints.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/say/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/say/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Say", 7 | products: [ 8 | .library( 9 | name: "Say", 10 | targets: ["Say"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Say", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SayTests", 19 | dependencies: ["Say"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/say/Sources/Say/Say.swift: -------------------------------------------------------------------------------- 1 | func say(number: Int) throws -> String { 2 | // Write your code for the 'Say' exercise in this file. 3 | } -------------------------------------------------------------------------------- /exercises/practice/scale-generator/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/scale-generator/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ScaleGenerator", 7 | products: [ 8 | .library( 9 | name: "ScaleGenerator", 10 | targets: ["ScaleGenerator"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "ScaleGenerator", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ScaleGeneratorTests", 19 | dependencies: ["ScaleGenerator"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | [Scrabble][wikipedia] is a word game where players place letter tiles on a board to form words. 4 | Each letter has a value. 5 | A word's score is the sum of its letters' values. 6 | 7 | [wikipedia]: https://en.wikipedia.org/wiki/Scrabble 8 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.meta/Sources/ScrabbleScore/ScrabbleScoreExample.swift: -------------------------------------------------------------------------------- 1 | let scrabbleScore: [String: Int] = [ 2 | "a": 1, "b": 3, "c": 3, "d": 2, 3 | "e": 1, "f": 4, "g": 2, "h": 4, 4 | "i": 1, "j": 8, "k": 5, "l": 1, 5 | "m": 3, "n": 1, "o": 1, "p": 3, 6 | "q": 10, "r": 1, "s": 1, "t": 1, 7 | "u": 1, "v": 4, "w": 4, "x": 8, 8 | "y": 4, "z": 10, 9 | ] 10 | 11 | func score(_ phrase: String) -> Int { 12 | return phrase.lowercased().reduce(0) { $0 + (scrabbleScore[String($1)] ?? 0) } 13 | } 14 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ScrabbleScore", 7 | products: [ 8 | .library( 9 | name: "ScrabbleScore", 10 | targets: ["ScrabbleScore"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "ScrabbleScore", 16 | dependencies: []), 17 | .testTarget( 18 | name: "ScrabbleScoreTests", 19 | dependencies: ["ScrabbleScore"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/Sources/ScrabbleScore/ScrabbleScore.swift: -------------------------------------------------------------------------------- 1 | func score(_ phrase: String) -> Int { 2 | // Write your code for the 'Scrabble Score' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You are starting a secret coding club with some friends and friends-of-friends. 4 | Not everyone knows each other, so you and your friends have decided to create a secret handshake that you can use to recognize that someone is a member. 5 | You don't want anyone who isn't in the know to be able to crack the code. 6 | 7 | You've designed the code so that one person says a number between 1 and 31, and the other person turns it into a series of actions. 8 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.meta/Sources/SecretHandshake/SecretHandshakeExample.swift: -------------------------------------------------------------------------------- 1 | let commandValues = [ 2 | 1: "wink", 3 | 2: "double blink", 4 | 4: "close your eyes", 5 | 8: "jump", 6 | ] 7 | 8 | func commands(number: Int) -> [String] { 9 | var result = [String]() 10 | 11 | for (value, name) in commandValues.sorted(by: <) { 12 | if number & value != 0 { 13 | result.append(name) 14 | } 15 | } 16 | 17 | if number & 16 != 0 { 18 | result.reverse() 19 | } 20 | 21 | return result 22 | } 23 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "SecretHandshake", 7 | products: [ 8 | .library( 9 | name: "SecretHandshake", 10 | targets: ["SecretHandshake"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "SecretHandshake", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SecretHandshakeTests", 19 | dependencies: ["SecretHandshake"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/Sources/SecretHandshake/SecretHandshake.swift: -------------------------------------------------------------------------------- 1 | func commands(number: Int) -> [String] { 2 | // Write your code for the 'Secret Handshake' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/series/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a string of digits, output all the contiguous substrings of length `n` in that string in the order that they appear. 4 | 5 | For example, the string "49142" has the following 3-digit series: 6 | 7 | - "491" 8 | - "914" 9 | - "142" 10 | 11 | And the following 4-digit series: 12 | 13 | - "4914" 14 | - "9142" 15 | 16 | And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get. 17 | 18 | Note that these series are only required to occupy _adjacent positions_ in the input; 19 | the digits need not be _numerically consecutive_. 20 | -------------------------------------------------------------------------------- /exercises/practice/series/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/series/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Series", 7 | products: [ 8 | .library( 9 | name: "Series", 10 | targets: ["Series"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Series", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SeriesTests", 19 | dependencies: ["Series"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/series/Sources/Series/Series.swift: -------------------------------------------------------------------------------- 1 | class Series { 2 | // Write your code for the 'Series' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You bought a big box of random computer parts at a garage sale. 4 | You've started putting the parts together to build custom computers. 5 | 6 | You want to test the performance of different combinations of parts, and decide to create your own benchmarking program to see how your computers compare. 7 | You choose the famous "Sieve of Eratosthenes" algorithm, an ancient algorithm, but one that should push your computers to the limits. 8 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.meta/Sources/Sieve/SieveExample.swift: -------------------------------------------------------------------------------- 1 | func sieve(limit: Int) -> [Int] { 2 | var result: [Int] = [] 3 | guard limit > 1 else { return result } 4 | var numbers: [Int] = Array(2...limit) 5 | while !numbers.isEmpty { 6 | let prime = numbers.removeFirst() 7 | result.append(prime) 8 | numbers = numbers.filter { $0 % prime != 0 } 9 | } 10 | return result 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/sieve/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Sieve", 7 | products: [ 8 | .library( 9 | name: "Sieve", 10 | targets: ["Sieve"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Sieve", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SieveTests", 19 | dependencies: ["Sieve"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/sieve/Sources/Sieve/Sieve.swift: -------------------------------------------------------------------------------- 1 | func sieve(limit: Int) -> [Int] { 2 | // Write your code for the 'Sieve' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/simple-cipher/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/simple-cipher/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "SimpleCipher", 7 | products: [ 8 | .library( 9 | name: "SimpleCipher", 10 | targets: ["SimpleCipher"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "SimpleCipher", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SimpleCipherTests", 19 | dependencies: ["SimpleCipher"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/simple-cipher/Sources/SimpleCipher/SimpleCipher.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/simple-linked-list/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a music streaming company. 4 | 5 | You've been tasked with creating a playlist feature for your music player application. 6 | -------------------------------------------------------------------------------- /exercises/practice/simple-linked-list/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/simple-linked-list/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "SimpleLinkedList", 7 | products: [ 8 | .library( 9 | name: "SimpleLinkedList", 10 | targets: ["SimpleLinkedList"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "SimpleLinkedList", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SimpleLinkedListTests", 19 | dependencies: ["SimpleLinkedList"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/simple-linked-list/Sources/SimpleLinkedList/SimpleLinkedList.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/space-age/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/space-age/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "SpaceAge", 7 | products: [ 8 | .library( 9 | name: "SpaceAge", 10 | targets: ["SpaceAge"]) 11 | ], 12 | dependencies: [ 13 | .package(url: "https://github.com/apple/swift-numerics", from: "1.0.3"), 14 | ], 15 | targets: [ 16 | .target( 17 | name: "SpaceAge"), 18 | .testTarget( 19 | name: "SpaceAgeTests", 20 | dependencies: [.product(name: "RealModule", package: "swift-numerics"), "SpaceAge"]), 21 | ] 22 | ) 23 | -------------------------------------------------------------------------------- /exercises/practice/strain/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | ## Adding method to the Array structure 2 | 3 | This exercise focuses on adding methods to the `Array` structure in Swift. 4 | This is easiest done through using [extensions][extensions]. 5 | 6 | ```swift 7 | extension Array { 8 | // Write your code for the 'Strain' exercise in this file. 9 | } 10 | ``` 11 | 12 | The `Array` documentation can be found [here][array]. 13 | 14 | [array]: https://developer.apple.com/documentation/swift/array 15 | [extensions]: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/extensions/ 16 | -------------------------------------------------------------------------------- /exercises/practice/strain/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/strain/.meta/Sources/Strain/StrainExample.swift: -------------------------------------------------------------------------------- 1 | extension Array { 2 | func keep(_ compare: Bool = true, inputFunc: (Element) -> Bool) -> Array { 3 | var array2Return: Array = [] 4 | for each in self { 5 | if inputFunc(each) == compare { 6 | array2Return.append(each) 7 | } 8 | } 9 | return array2Return 10 | } 11 | 12 | func discard(_ inputFunc: (Element) -> Bool) -> Array { 13 | return keep(false, inputFunc: inputFunc) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /exercises/practice/strain/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Strain", 7 | products: [ 8 | .library( 9 | name: "Strain", 10 | targets: ["Strain"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Strain", 16 | dependencies: []), 17 | .testTarget( 18 | name: "StrainTests", 19 | dependencies: ["Strain"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/strain/Sources/Strain/Strain.swift: -------------------------------------------------------------------------------- 1 | extension Array { 2 | // Write your code for the 'Strain' exercise in this file. 3 | } 4 | 5 | -------------------------------------------------------------------------------- /exercises/practice/sublist/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/sublist/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | "kytrinyx" 4 | ], 5 | "contributors": [ 6 | "bhargavg", 7 | "harquail", 8 | "lyuha", 9 | "masters3d", 10 | "ThomasHaz" 11 | ], 12 | "files": { 13 | "solution": [ 14 | "Sources/Sublist/Sublist.swift" 15 | ], 16 | "test": [ 17 | "Tests/SublistTests/SublistTests.swift" 18 | ], 19 | "example": [ 20 | ".meta/Sources/Sublist/SublistExample.swift" 21 | ] 22 | }, 23 | "blurb": "Write a function to determine if a list is a sublist of another list." 24 | } 25 | -------------------------------------------------------------------------------- /exercises/practice/sublist/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Sublist", 7 | products: [ 8 | .library( 9 | name: "Sublist", 10 | targets: ["Sublist"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Sublist", 16 | dependencies: []), 17 | .testTarget( 18 | name: "SublistTests", 19 | dependencies: ["Sublist"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/sublist/Sources/Sublist/Sublist.swift: -------------------------------------------------------------------------------- 1 | // Write your code for the 'Sublist' exercise in this method. -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a company that makes an online, fantasy-survival game. 4 | 5 | When a player finishes a level, they are awarded energy points. 6 | The amount of energy awarded depends on which magical items the player found while exploring that level. 7 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.meta/Sources/SumOfMultiples/SumOfMultiplesExample.swift: -------------------------------------------------------------------------------- 1 | func toLimit(_ limit: Int, inMultiples: [Int]) -> Int { 2 | guard limit > 0 else { return 0 } 3 | var multiples = Set(inMultiples) 4 | 5 | if let indexOfZero = multiples.index(of: 0) { 6 | multiples.remove(at: indexOfZero) 7 | } 8 | 9 | var itemToReturn = 0 10 | 11 | for each in 1.. Int { 2 | // Write your code for the 'SumOfMultiples' exercise in this method. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/tournament/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/tournament/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Tournament", 7 | products: [ 8 | .library( 9 | name: "Tournament", 10 | targets: ["Tournament"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Tournament", 16 | dependencies: []), 17 | .testTarget( 18 | name: "TournamentTests", 19 | dependencies: ["Tournament"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/tournament/Sources/Tournament/Tournament.swift: -------------------------------------------------------------------------------- 1 | class Tournament { 2 | // Write your code for the 'Tournament' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/transpose/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/transpose/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Transpose", 7 | products: [ 8 | .library( 9 | name: "Transpose", 10 | targets: ["Transpose"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Transpose", 16 | dependencies: []), 17 | .testTarget( 18 | name: "TransposeTests", 19 | dependencies: ["Transpose"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/transpose/Sources/Transpose/Transpose.swift: -------------------------------------------------------------------------------- 1 | struct Transpose { 2 | static func transpose(_ lines: [String]) -> [String] { 3 | // Write your code for the 'Transpose' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/triangle/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/triangle/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Triangle", 7 | products: [ 8 | .library( 9 | name: "Triangle", 10 | targets: ["Triangle"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Triangle", 16 | dependencies: []), 17 | .testTarget( 18 | name: "TriangleTests", 19 | dependencies: ["Triangle"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/triangle/Sources/Triangle/Triangle.swift: -------------------------------------------------------------------------------- 1 | class Triangle { 2 | // Write your code for the 'Triangle' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/trinary/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/trinary/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Trinary", 7 | products: [ 8 | .library( 9 | name: "Trinary", 10 | targets: ["Trinary"]), 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Trinary", 16 | dependencies: []), 17 | .testTarget( 18 | name: "TrinaryTests", 19 | dependencies: ["Trinary"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/trinary/Sources/Trinary/Trinary.swift: -------------------------------------------------------------------------------- 1 | //Solution goes in Sources 2 | -------------------------------------------------------------------------------- /exercises/practice/twelve-days/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/twelve-days/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "TwelveDays", 7 | products: [ 8 | .library( 9 | name: "TwelveDays", 10 | targets: ["TwelveDays"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "TwelveDays", 16 | dependencies: []), 17 | .testTarget( 18 | name: "TwelveDaysTests", 19 | dependencies: ["TwelveDays"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/twelve-days/Sources/TwelveDays/TwelveDays.swift: -------------------------------------------------------------------------------- 1 | class TwelveDaysSong { 2 | static func recite(start: Int, end: Int) -> String { 3 | // Write your code for the 'TwelveDaysSong' exercise in this file. 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | In some English accents, when you say "two for" quickly, it sounds like "two fer". 4 | Two-for-one is a way of saying that if you buy one, you also get one for free. 5 | So the phrase "two-fer" often implies a two-for-one offer. 6 | 7 | Imagine a bakery that has a holiday offer where you can buy two cookies for the price of one ("two-fer one!"). 8 | You take the offer and (very generously) decide to give the extra cookie to someone else in the queue. 9 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.meta/Sources/TwoFer/TwoFerExample.swift: -------------------------------------------------------------------------------- 1 | func twoFer(name: String = "you") -> String { 2 | return "One for \(name), one for me." 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "TwoFer", 7 | products: [ 8 | .library( 9 | name: "TwoFer", 10 | targets: ["TwoFer"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "TwoFer", 16 | dependencies: []), 17 | .testTarget( 18 | name: "TwoFerTests", 19 | dependencies: ["TwoFer"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/Sources/TwoFer/TwoFer.swift: -------------------------------------------------------------------------------- 1 | // Write your code for the 'TwoFer' exercise in this file. -------------------------------------------------------------------------------- /exercises/practice/word-count/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You teach English as a foreign language to high school students. 4 | 5 | You've decided to base your entire curriculum on TV shows. 6 | You need to analyze which words are used, and how often they're repeated. 7 | 8 | This will let you choose the simplest shows to start with, and to gradually increase the difficulty as time passes. 9 | -------------------------------------------------------------------------------- /exercises/practice/word-count/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/word-count/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "WordCount", 7 | products: [ 8 | .library( 9 | name: "WordCount", 10 | targets: ["WordCount"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "WordCount", 16 | dependencies: []), 17 | .testTarget( 18 | name: "WordCountTests", 19 | dependencies: ["WordCount"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/word-count/Sources/WordCount/WordCount.swift: -------------------------------------------------------------------------------- 1 | class WordCount { 2 | // Write your code for the 'WordCount' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/practice/wordy/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /exercises/practice/wordy/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Wordy", 7 | products: [ 8 | .library( 9 | name: "Wordy", 10 | targets: ["Wordy"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "Wordy", 16 | dependencies: []), 17 | .testTarget( 18 | name: "WordyTests", 19 | dependencies: ["Wordy"]), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /exercises/practice/wordy/Sources/Wordy/Wordy.swift: -------------------------------------------------------------------------------- 1 | func wordyAnswer(_ question: String) throws -> Int { 2 | // Write your code for the 'Wordy' exercise in this file. 3 | } 4 | -------------------------------------------------------------------------------- /exercises/shared/.docs/cli.md: -------------------------------------------------------------------------------- 1 | # Cli 2 | 3 | -------------------------------------------------------------------------------- /exercises/shared/.docs/debug.md: -------------------------------------------------------------------------------- 1 | # Debug 2 | 3 | -------------------------------------------------------------------------------- /exercises/shared/.docs/help.md: -------------------------------------------------------------------------------- 1 | # Help 2 | 3 | - [The Swift Programming Language Website](https://swift.org/documentation/) 4 | - [/r/swift](https://www.reddit.com/r/swift) 5 | - [StackOverflow](http://stackoverflow.com/questions/tagged/swift) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. 6 | -------------------------------------------------------------------------------- /exercises/shared/.docs/tests.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | You can run the tests by executing the following command in the exercise's directory: 4 | 5 | ```bash 6 | swift test 7 | ``` 8 | --------------------------------------------------------------------------------