The question mentions of Subarray (which is like a substring in the string)

I think you are assuming it to be any subset, in that case even O(n^3) time 
will not be sufficient and its an exponential time algorithm.

with the subarray like my assumption, the bruteforce approach will be to 
find all the n^2 sub array's and for each find if satisfies in O(n) time, 
using the similar logic, 
maintain left, right & start adding the ends and coming towards the center. 
which results in O(n^3) time.

let me know if my understanding is wrong.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/BRDRMATaJo8J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to