Trying to import random in Python gives a compile error. The module is not loaded by default either.
What's the easiest way to generate pseudorandom integers?
Can you explain why you need a random number generator in the first place. I presume that you may want to try a randomized algorithm, but that is probably not the kind of answer your interviewer might be expecting; All questions on OJ are supposed to be solved in a deterministic way, as do most interview questions in real life.
Yes I was going to try a randomized algorithm, but I found a better solution now.
However, I was hoping to find out if it is possible in general to use the random module in OJ. Is it just allowed for certain problems? Or not at all?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.