Dynamic Programming总结 (持续更新)

DP可以说是面试中比较难得题型,代码本身不会太复杂,难在想清楚问题,如何转换状态。 本文抛砖引玉,一起研究下DP专题常考的题目。 House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police....

July 15, 2020 · 2 min · Me

Learn Web Programming in Go by Examples

Codelab of building web applications in Golang

July 3, 2020 · 1 min · Me

Tips for 公开演讲

MIT教授关于how to speak公开课笔记

May 25, 2020 · 1 min · Me

Go Waitgroup

This post is to introduce a type in GoLang called WaitGroup Introduction https://golang.org/pkg/sync/#WaitGroup A WaitGroup waits for a collection of goroutines to finish. The main goroutine calls Add to set the number of goroutines to wait for. Then each of the goroutines runs and calls Done when finished. At the same time, Wait can be used to block until all goroutines have finished. A WaitGroup must not be copied after first use....

March 21, 2020 · 1 min · Me

567. Permutation in String

Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s permutations is the substring of the second string. Example 1: Input: s1 = “ab” s2 = “eidbaooo” Output: True Explanation: s2 contains one permutation of s1 (“ba”). Example 2: Input:s1= “ab” s2 = “eidboaoo” Output: False class Solution { public boolean checkInclusion(String s1, String s2) { Map<Character, Integer> map = new HashMap<>(); for (char ch : s1....

March 21, 2020 · 1 min · Me