Capital One·Software Engineer·Online Assessment (OA)
- Given an array of positive integers and an integer k >= 1, count how many elements in the array are exact powers of k. Handle the edge case where k equals 1 separately.
- On a planet where moon phases cycle every 8 days (indices 0 through 7), you're given the starting phase on day 1 and a list of month lengths for that year. For a given target date (month, day), compute the moon phase index on that date.
- Simulate a bubble-explosion mechanic on an R x C grid: repeatedly find any 4-directionally connected group of the same color with size >= T, remove it (set to 0), then apply gravity so remaining cells fall to the bottom of their columns. Repeat until no more groups can be removed, then return the final grid.
- Given an array of N numeric strings of equal length L (leading zeros allowed), count unordered pairs where one string can be transformed into the other using at most two character swaps within a single string. Analyze time and space complexity.
“This was the warmup and I almost tripped on the k=1 case.”