Skip to content

Instantly share code, notes, and snippets.

View thekoushik's full-sized avatar
👋
I may be slow to respond.

Koushik Seal thekoushik

👋
I may be slow to respond.
View GitHub Profile
@thekoushik
thekoushik / CustomBaseEncoderDecoder.js
Created April 20, 2023 05:09
Custom Base Encoder and Decoder
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
/**
* Encodes a positive integer to a string using a
* list of unique characters.
*
* @param {number} num - Positive integer
* @returns {string} Encoded string
*/
function encode(num) {