samuelsogbesan / leetbot

LeetCode Question Bot for Discord.
Apache License 2.0
1 stars 0 forks source link

Enum for LeetCode question difficulty #28

Closed samuelsogbesan closed 3 years ago

samuelsogbesan commented 3 years ago

Basically I'm not sure how we're going to represent difficulty yet in questions database. It'll either be an integer between 0 and 2, 0 meaning easy and 2 meaning hard or it'll be a string ("EASY", "MEDIUM" or "HARD")

So to abstract away the implementation detail, we need an enum to represent that difficulty.

It'll be something like:

difficulty = { EASY: valueForEasy, MEDIUM: valueForMedium, HARD: valueForHard }

That way we can use it something like:

const question = fetchQuestion() if (question.difficulty === difficulty.EASY): { do stuff }

So we literally need a file with a Javascript Object in it. Put the file in the path constants/difficulty.js