Traverse Spiral Matrix

  1. Traverse Spiral Matrix

The trick of traverse a matrix in spiral order is that we need to have flags to keep the boundary. Let’s check LeetCode problerm 54. Spiral Matrix

Read More

Time Complexity Calculation Template

  1. O(n)
1
2
3
4
for i := 0; i < n; i++ {
//statements
}

Read More

Binary Search Code Template Deep Dive

Let’s take a look at a easy problem on Leetcode 704. Binary Search. Besides the brute-force O(n) solution, it’s not hard to get the O(log(n)) solution from the constrains unique and sorted in ascending order. Binary search is one of the most basic algorithms we are using, but most people couldn’t get the right code.

Read More

Understand Golang's Function Type

Based on Golang’s function type spec:

1
A function type denotes the set of all functions with the same parameter and result types

Read More

JavaScript Async Ready Looping

When you are following functional programming style guide to write JavaScript, you may find that it’s hard to deal with asynchronous since async function always return promises. So code like below will resolve the promises at same time instead of waiting for them.

Read More

Understand X-Forwarded-Proto

HTTP requests and HTTP responses use header fields to send information about the HTTP messages. Header fields are colon-separated name-value pairs that are separated by a carriage return (CR) and a line feed (LF). A standard set of HTTP header fields is defined in RFC 2616. There are also non-standard HTTP headers available that are widely used by the applications. Some of the non-standard HTTP headers have an X-Forwarded prefix.

Read More

Serving Files on S3 through NodeJS

NodeJS stream is one of the most powerful modules built-in. If you need to serve files on S3 through NodeJS service, a good idea is to leverage the compatibility of stream, especially if you want to serve big files.

Read More

Add WaterMark with JavaScript to Your Website

If you are an enterprise application developer, you may want to add watermark to your application. You can use below JS to applications like Confluence, Jira and so on. Just need to paste below JS code.

Read More

Computer Vision Tasks Summary

I’m start reading this book <Deep Learning with TensorFlow 2 and Keras> those days, and will keep posting what I learnt from the book here.

Read More

Loading Image to Google Colab Notebooks

Google Colab is one of the best place to start your Machine Learning. Sometime you may want to upload images to the notebooks from your local. Fortunately you can easily make it done throught the built-in API.

Read More