Two Sum: find two number from array of integers and thats sum equal to target integer
O(n2) runtime, O(1) space – Brute force: The brute force approach is simple. Loop through each element x and find if there is another value that equals to target – x. As finding another value requires looping through the rest of array, its runtime complexity is O(n2). O(n) runtime, O(n) space – Hash table: We…
How can I login users without password in Django?
There are times when you are not worried about user authentication but still want to have each user sees only his/her stuff. Then you need a way to login to a user without the password. Normally, when logging a user with the password, authenticate() has to be called before login(): What authenticate does is to add an…
Difference between AbstractUser and AbstractBaseUser in Django?
The documentation explains this fully. AbstractUser is a full User model, complete with fields, as an abstract class so that you can inherit from it and add your own profile fields and methods. AbstractBaseUser only contains the authentication functionality, but no actual fields: you have to supply them when you subclass.