Getting started with vcluster
What are Virtual Kubernetes Clusters(VCluster)?
Virtual clusters are fully working Kubernetes clusters that run on top of other Kubernetes clusters. Compared to fully separate “real” clusters, virtual clusters reuse worker nodes and networking of the host cluster. They have their own control plane and schedule all workloads into a single namespace of the host cluster. Like virtual machines, virtual clusters partition a single physical cluster into multiple separate ones.
Common used functions in Python
index()
The index() method returns the index of the specified element in the list.
1 | animals = ['cat', 'dog', 'rabbit', 'horse'] |
set()
1 | triplets = set() # automatically remove duplicates |
isalnum()
The isalnum() method returns True if all the characters are alphanumeric, meaning alphabet letter (a-z) and numbers (0-9).
1 | class Solution: |
ord()
ord() function returns the Unicode code from a given character.
Heap and priority queue in Python
Dynamic programming
What is Dynamic Programming?
Dynamic Programming is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of subproblems, so that we do not have to re-compute them when needed later. This simple optimization reduces time complexities from exponential to polynomial.
Leetcode algorithm questions
Best time to buy and sell stock
[Leetcode 121] Best Time to Buy and Sell Stock
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.
Bit manipulation
Monotonic stack
What is a Monotonic Stack
A monotonic stack is a stack whose elements are monotonically increasing or decreasing. It contains all properties that a typical stack has and its elements are monotonic decreasing or increasing.
Monotonic increasing stack: [2 3 5 6 9]
Monotonic decreasing stack: [9 6 5 3 2]
Linked list in Python
Intro
A linked list is a data structure which represents a sequence of nodes. In a singly linked list, each node points to the next node. In a doubly linked list, each node points to both the next and previous node.