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 | 591 Views, 27560 Search Bots | 63 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 591 Views, 27560 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 | 591 Views, 27560 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
- Design Tic-Tac-Toe
- PHP Unit Tests on VPS Server
- Non-decreasing Array with Single Modification
- Daily Interview Problem: Deepest Node in a Binary Tree
- Daily Interview Puzzle: Intersection of Linked Lists
- Top K Frequent words
- First and Last Indices of an Element in a Sorted Array
- Autorun.inf Virus Protection
- Invert a Binary Tree
- Daily Interview Puzzle: Minimum Size Subarray Sum
©2006~2024 SteakOverCooked - 0.00925 Seconds(s) - 2067.356 KB/s - 8 Online Memory: 492.58 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 !