Friday, September 18, 2015

MJ [38] Target Sum

Question:
Given an array A, determine if there is a subarray with sum equal to a given target.
Eg., if A = {4, 7, -5, 6, -2, 1} and target = 8. It should return true because sum{7, -5, 6} = 8. If target = 3, it should return false.

Ref
[1] http://www.mitbbs.com/article_t/JobHunting/32957899.html
[2] http://www.geeksforgeeks.org/find-if-there-is-a-subarray-with-0-sum/

No comments:

Post a Comment