Tag Archives: decode

LeetCode 91. Decode Ways (javascript solution) – JavaScript Dev Feed

LeetCode 91. Decode Ways (javascript solution) Description: A message containing letters from A-Z can be encoded into numbers using the following mapping: ‘A’ -> “1”‘B’ -> “2”…‘Z’ -> “26”To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple…

Read More

Encode Decode JWT – Python Dev Feed

Encode Decode JWT JWT stands for JSON Web Tokens. A simple function to encode the content – ”’ Encode the given text with given secret key. The default number of seconds for token validity is 600 seconds. ”’ def encode_token(text, secret_key, validity_seconds = 600): import datetime, jwt try: payload = { ‘exp’: datetime.datetime.utcnow() + datetime.timedelta(days=0,…

Read More