Need continuous some smaller/larger value? Use heap max or min as you need.

  1. Effectively Using Django REST Framework Serializers
  2. How To Use DRF Serializers Effectively in Django
  3. My personal django rest framework serializer notes
  4. How to use DRF serializers effectively during write operations

Best Django REST Framework Views Series Part 1 Part 2 Part 3

when you have something circular, most of the time you can have one variableand another can be calculated using size, current value and doing %

LRUCache can be implemented - Hashmap + Doubly Linked List - Python Dict/OrderDict - HashMap + List At least I've tested them for fun :p

(k := next(iter(d)), d.pop(k)) will remove the leftmost (first) item (if it exists) from a dict object. And if you want to remove the right most/recent value from the dict

d.popitem()

From python 3.7 dict guarantees that order will be kept as they inserted, and popitem will use LIFO order but we need FIFO type system. so we need OrderedDict which have popIten(last = T/F) for this req. One thing, next(iter(dict)) will return the first key of the dict

leetcode problem 287. Find the Duplicate Number has 7 solving approach. WOW!!!

Floyd's Hare and Tortoise algorithm best exaplanation video

Floyd's Tortoise and Hare is used to detect linked list cycle.

time.perf_counter() always returns the float value of time in seconds. while pref_counter_ns() always gives the integer value of time in nanoseconds.


t1_start = perf_counter()
t1_stop = perf_counter()
print("Elapsed time:", t1_stop, t1_start)

Substring a String

  • string[start:end:step]
  • from first string[2:6]
  • last char string[-1]
  • last char by index string[-1]
  • from last string[-5:]
  • first to last string[1:-4]

Amortized time is the way to express the time complexity when an algorithm has the very bad time complexity only once in a while besides the time complexity that happens most of time. Good example would be an ArrayList which is a data structure that contains an array and can be extended.

Pythonic Time Complexity Wiki

Important to remember

His posts are really helpful, FAANG tips Link

Started keeping online notes!