Honestly most interviews should just stick to arrays since they are the most important data structure. But some just make things needlessly hard to weed people out and thatโs just a dick move.
9 months ago | 13
I would say that two pointers also includes algorithms where you have a pointer in one array and a pointer in another array, and you calculate something at each entry as they slide along to the end.
9 months ago | 5
Any algorithm on a collection can technically be implemented in O(1) time if you just always loop through the entire range of indexes that your iteration data type supports
9 months ago | 0
What tools do you use to create this GIF..? Great Content BTW
9 months ago (edited) | 1
How is MaxSum=5 in Cadane's algo, second iteration. It should be 4 right? Might be a typo
9 months ago | 1
NeetCodeIO
Arrays are one of the most common interview topics.
Here are four to patterns that are a must know.
๐ญ. ๐๐ฎ๐ฑ๐ฎ๐ป๐ฒ'๐ ๐๐น๐ด๐ผ๐ฟ๐ถ๐๐ต๐บ - An efficient algorithm used to find the maximum subarray sum.
๐ฎ. ๐ง๐๐ผ ๐ฃ๐ผ๐ถ๐ป๐๐ฒ๐ฟ๐ - Use two pointers, e.g. left and right, typically starting at different positions, e.g., start and end of an array, and move them based on specific conditions to solve the problem.
๐ฏ. ๐ฆ๐น๐ถ๐ฑ๐ถ๐ป๐ด ๐ช๐ถ๐ป๐ฑ๐ผ๐ - Expand the window by adding elements from the right until the constraint is broken. Shrink the window by removing elements from the left. Repeat until a valid window is found.
๐ฐ. ๐ฃ๐ฟ๐ฒ๐ณ๐ถ๐ ๐ฆ๐๐บ - Used to calculate the running sum of a subarray efficiently.
โ
Preparing for coding interviews? Check out neetcode.io/
9 months ago (edited) | [YT] | 1,379