Skip to content

szkjn/algorithmic-playground

Repository files navigation

Algorithmic Playground

example workflow example workflow example workflow

Python (tests/scripts) Go (tests/scripts) TypeScript (tests/scripts)

Overview

This repository is a hub for algorithmic exercises and coding challenges from various sources (Rendezvous with cassidoo / HackerRank / Codewars) to sharpen my skills in Python, Go, Typescript and other side-projects languages. All exercises problems are written in comments at the beginning of the corresponding script.

Repository structure

  • Each language has its own directory (Python, Go, TypeScript, Solidity).
  • Within the Go directory, every exercise is contained in its own subdirectory, each with go.mod, main.go and main_test.go files.
  • Other languages are organized similarly, following the best practices of each language.

Content summary

How many opened doors ? python
Anti-Divisor python go
Combine strings python
Zero run replacer python
Max Subarray python typescript solidity
Swap Pairs python go typescript solidity
Decode Morse Code python go typescript
Sum every other digit python go typescript
Get A1 Reference number python go
Are two strings isomorphic ? python go
Ceaser Cipher go
Mars exploration go
Subsequence string search go typescript
Diagonal difference go
Min-max sum go
Highest candles python go
Time conversion go typescript

Installation

TBD (librairies, requirements.txt)

Execution instructions

Python

  • Run scripts :

      cd algorithmic-playground/Python/scripts
      python <name_of_script>.py
    
  • Run linter :

      cd algorithmic-playground/Python/
      black .
    
  • Run tests :

      cd algorithmic-playground/Python/
      pytest
    

Go

  • Run scripts :

      cd algorithmic-playground/Go/<name_of_folder>
      go run main.go
    
  • Run linter :

      cd algorithmic-playground/Go/
      golint ./...
    
  • Run tests :

      cd algorithmic-playground/Go/<name_of_folder>
      go test
    

TypeScript

  • Run scripts :

      cd algorithmic-playground/TypeScript/src
      ts-node <name_of_script>
    
  • Run linter :

      cd algorithmic-playground/TypeScript/
      ./node_modules/.bin/eslint .
    
  • Run tests :

      cd algorithmic-playground/TypeScript/tests
      npx jest
    

CI/CD with GitHub Actions

A Continuous Integration (CI) pipeline has been setup using GitHub Actions to ensure code quality, consistency, and successful builds for both our Go and TypeScript code.

Go CI

  1. Linting on Push and Pull Requests: Whenever code is pushed or a pull request is made, the CI pipeline automatically lints the Go code to ensure coding standards are met.
  2. Automated Testing: Along with linting, the pipeline runs tests for the Go code to validate functionality.
  3. Tools Used: I use golint for linting and Go's built-in testing framework for running tests.
  4. GitHub Actions Workflow: The linting process is defined in the .github/workflows/go-ci.yml file, utilizing GitHub Actions to automatically execute linting and testing on the latest version of Go.

Python CI

  1. Linting on Push and Pull Requests: Whenever code is pushed or a pull request is made, the CI pipeline automatically lints the Python code to ensure coding standards are met.
  2. Automated Testing: Along with linting, the pipeline runs tests for the Python code to validate functionality.
  3. Tools Used: I use black for linting and pytest for running tests.
  4. GitHub Actions Workflow: The CI process is defined in the .github/workflows/python-ci.yml file, utilizing GitHub Actions to automatically execute linting and testing on the latest version of Go.

TypeScript CI

  1. Build on Push and Pull Requests: The CI pipeline is configured to automatically build TypeScript files whenever changes are pushed or a pull request is made to the TypeScript directory.
  2. Node.js Setup: The workflow sets up a Node.js environment to manage dependencies and run the build scripts.
  3. Build Script: TypeScript files are compiled using the TypeScript compiler configured in the package.json file.
  4. Workflow Details: The TypeScript build process is defined in the .github/workflows/typescript-ci.yml file. It ensures that TypeScript code is compiled successfully, preventing runtime errors due to compilation issues.

About

Code snippets of algorithm exercises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published