Question:
Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list.

word1 and word2 may be the same, and they represent two individual words in the list.

Read more »

Question:
Design a class which receives a list of words in the constructor, and implements a method that takes two words word1 and word2 and return the shortest distance between these two words in the list. Your method will be called repeatedly many times with different parameters.

Read more »

就地避難 (Shelter in place)

本來打算趁今天天氣不錯總算出太陽了,打算帶小孩去 Golden Gate Park 散散心避開人潮,畢竟現在 COVID-19 太過嚴重,最好還是不要去人多的地方增加感染的機率! 結果就在我們做好便當 (打算去踏青,順便找個無人的草原野餐) 準備出發的時候,竟然收到這則消息 -

原來就在今天舊金山市長 London Breed宣布整個舊金山在 3/17 凌晨 0:00 am 進入就地避難(Shelter in place) 的狀態,這還是我第一次在美國遇到這種狀況. 就上網查查現在是什麼情況.

Read more »

dagger-in-android.png?w=2924

In Dagger, it provides another way to inject/provide resources by using constructor injection. The typical case is that we use constructor injection in a class to inject needed resources as class parameters. In this way, we can directly use the required resources without declaring the @Inject keyword. Another pro tip is that it has very high potentialities to let your injection more robust and more flexible. Let’s see how we can use constructor injection for providing multi-source injection for the different release versions.

Read more »

kotlin-coroutines-1.png?w=2924

I recently read the source code of Coroutines. It’s pretty fun, and I’ve learned a lot from the source code. I am going to share some I learned here. I would break the learning into several parts. I hope everyone can find something useful for your projects.

Read more »