File: root - text - article - 2020 - 01 - subarray-with-target-sum.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 566 Views, 26316 Search Bots | 63 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 566 Views, 26316 Search Bots | 63 Words
| Browse | Archive
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.
Can you do this in linear time?
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 566 Views, 26316 Search Bots | 63 Words 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?
Related Articles
- Absolute Path
- Algorithm Interview: Determine If Linked List is Palindrome
- Daily Interview Problem: Merge Overlapping Intervals
- Multitasking
- Daily Interview Problem: Running Median
- Batch Programming in XP
- Daily Interview Problem: Arithmetic Binary Tree
- ImageMagick Vulnerabilities - CVE-2016–3714
- Fibonacci coding
- Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals
©2006~2024 SteakOverCooked - 0.00798 Seconds(s) - 6692.25 KB/s - 34 Online Memory: 527.51 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !