Recca Chao 的 gitHub page

推廣網站開發,包含 Laravel 和 Kotlin 後端撰寫、自動化測試、讀書心得等。Taiwan Kotlin User Group 管理員。

View on GitHub

Hi, here’s your problem today. This problem was recently asked by Amazon:

You are given an array of integers, and an integer K. Return the subarray which sums to K. You can assume that a solution will always exist.

def find_continuous_k(list, k):

Fill this in.

print find_continuous_k([1, 3, 2, 5, 7, 2], 14)

[2, 5, 7]

Can you do this in linear time?