Despite having seen all these concepts more than a thousand times, I’m still getting confused sometimes. Is there a good way to think about all these concepts so that they start making sense?
In this post, I will focus on how to remember them. If you’re not familiar with them, please read the following posts first.
A confusion matrix is a table used to evaluate the performance of a classification model. It summarizes the count combinations of every predicted and actual class.
Let’s understand this concept in a simple example. Below…
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.
Redis is the world’s most popular in-memory data structure server. In order to make good use of it, we need to understand its basic data structures first.
The Redis String type is the simplest type of value you can associate with a Redis key. …
A company is planning to interview 2N
people. Given the array costs
, the cost of flying the i-th
person to city A
is costs[i][0]
, and the cost of flying the i-th
person to city B
is costs[i][1]
.
Return the minimum cost to fly every person to a city such that exactly n
people arrive in each city.
Example 1:
Input: costs = [[10,20],[30,200],[400,50],[30,20]] Output: 110 Explanation: The first person goes to city A for a cost of 10. The second person goes to city A for a cost of 30. The third person goes to city B for a cost…
Backtracking algorithm is a really cool technique to solve some kind of puzzles like N queen problem, sudoku problem.
This post provides a framework or blueprint to conquer these kinds of problems.
Backtracking is a general algorithm for finding solutions to some computational problems.
It incrementally builds candidates to the solutions and abandons each partial candidate as soon as it determines that the candidate cannot possibly be completed.
Be similar to a brute force algorithm, a backtracking algorithm essentially explores all solutions. However, In backtracking, we stop evaluating a possibility as soon as it breaks some constraint provided in the…
Bitwise operations are hard to understand for some beginning programmers. So this post is to explain them easily and unforgettably.
A bit is the smallest unit of information that can be stored or manipulated on a computer. It consists of a single Boolean value (0 or 1).
A bit string is a sequence of bits. It can be used to represent sets or to manipulate binary data.
The bitwise AND operator (&
) returns a 1
in each bit position for which the corresponding bits of both operands (input and mask) are 1
s.
Two principles:
a. Y AND 1 = Y
…
Linked-List is the high frequently interviewed question for software engineers. Even though this data structure is easy to understand, interview problems related to it, however, are not easy to solve.
Because it’s very difficult to predict ahead what you will need to end up with in terms of temporary pointers just by writing a line of codes one after the others.
A standard step by step procedure helps:
A binary Tree is a tree-like data structure where every node has at most two children.
If you flip the tree upside down, it kind of looks like a tree. That’s where the name comes from!
class TreeNode: def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
How to recognize the leaf node in code?
…
Let’s understand binary tree creation details by a little example.
The Definition ofTreeNode
is the following.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
root
— the variable is useful to access the binary treecurnode
— the variable is for iteration inside of the binary treeroot = curnode = TreeNode(val=1)
Creating two child tree node, their parent node curnode
is used
curnode.left = TreeNode(1)
curnode.right = TreeNode(2)
Binary Tree traversal such as preorder traversal, inorder traversal, postorder traversal, and level order traversal is commonly interviewed by many IT companies. So why not conquer the monster only in this post?
Preorder means “Visit” a node first, then traverse its children.
We walk the graph, from top going counter-clockwise. Shout every time we pass the LEFT of a node.
Recursive implementation
To convert an inherently recursive procedure to an iterative one, we need an explicit stack. Iterative implementation as following:
Recognize Captcha is a human-centered test to distinguish a human from bots. Some of the captchas are easy to crack, while others may need to adopt advanced techniques such as deep learning.
In this series, I will focus on bypassing a certain kind of captcha problem — slide captcha problem using a deep learning method.
It is easy to understand that this captcha problem is an object detection problem.
Object detection is a computer vision technique that allows us to identify and locate objects in an image or video.
Developer in China, AI and machine learning enthusiast