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 | 567 Views, 26351 Search Bots | 63 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 567 Views, 26351 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 | 567 Views, 26351 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: Word Ordering in a Different Alphabetical Order
- Daily Interview Problem: Longest Substring With K Distinct Characters
- Two Tricks of Delphi
- [Daily Problem] Remove Consecutive Nodes that Sum to 0
- Algorithm Interview: Lowest Common Ancestor of 2 Nodes in Binary Tree
- ImageMagick Vulnerabilities - CVE-2016–3714
- [Daily Problem] Angles of a Clock
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Reverse a Directed Graph
- Algorithm Interview: Longest Consecutive Sequence
©2006~2024 SteakOverCooked - 0.00743 Seconds(s) - 7227.22 KB/s - 30 Online Memory: 527.79 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 !