Snowflake Interview Question

Find the longest subarray that equals K

Interview Answer

Anonymous

Apr 26, 2018

I gave the naive approach which is O(n^2). But the interviewer gave prefix sum array and was expecting me to optimize the problem.