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 | 568 Views, 26365 Search Bots | 63 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 568 Views, 26365 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 | 568 Views, 26365 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: Merge K Sorted Linked Lists
- Daily Interview Question: Word Search
- Daily Interview Problem: Merge Overlapping Intervals
- [Daily Problem] Longest Palindromic Substring
- Algorithm Interview: Smallest Number that is not a Sum of a Subset of List
- Spreadsheet Column Title
- Daily Interview Problem: Word Ordering in a Different Alphabetical Order
- First and Last Indices of an Element in a Sorted Array
- Floor and Ceiling of a Binary Search Tree
- Invert a Binary Tree
©2006~2024 SteakOverCooked - 0.00907 Seconds(s) - 2053.859 KB/s - 21 Online Memory: 492.17 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 !