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, 26310 Search Bots | 63 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 566 Views, 26310 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, 26310 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
- Daily Interview Problem: Find the k-th Largest Element in a List
- Daily Interview Puzzle: Minimum Size Subarray Sum
- [Daily Problem] Move Zeros
- Kaprekar
- [Daily Problem] Remove k-th Last Element From Linked List
- Algorithm Interview: Make the Largest Number
- Daily Interview Problem: Decode String
- [Daily Problem] Course Prerequisites
- Algorithm Interview: Shifted String
- Making a Height Balanced Binary Search Tree
©2006~2024 SteakOverCooked - 0.00726 Seconds(s) - 2690.829 KB/s - 27 Online Memory: 491.82 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 !