Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals k.
A subarray is a contiguous non-empty sequence of elements within an array.
Example 1:
Input: nums = [1,1,1], k = 2
Output: 2
Example 2:
Input: nums = [1,2,3], k = 3
Output: 2
Given a tree, how long will it take to visit all X nodes optimally?
Traversing one edge takes 1 unit of time. You must return back to the root (Start).
In the tree above, the answer is 6.
Given a calendar year represented as a char array that contains either H or W, where:
H= HolidayW= Workday
Given a number of Personal Time-Off days (PTO), maximize the length of the longest vacation you can take.
Example:
[W, H, H, W, W, H, W], PTO = 2
Your maximum vacation is 5 days.
These Meta VO questions combine three common patterns: prefix sum with a hash map for counting subarrays whose sum equals k, tree traversal cost modeling for visiting all target nodes and returning to the root, and a sliding window / two-pointer approach for maximizing the longest vacation by using PTO days to cover workdays. The key is to translate each story into a standard interview pattern and then optimize for linear-time scanning whenever possible.