Cisco·Software Engineer·Technical Phone Screen
- Given an integer array, find the contiguous subarray with the maximum sum and return the sum along with its start and end indices. If there are ties in sum, prefer the shorter subarray, then the earliest start. Must run in O(n) time with O(1) space. Also explain how your solution handles arrays where all values are negative.
- Given an array of integers, return the smallest value that appears exactly once. Return the minimum among all such values, or -1 if none exist. Aim for O(n) time. Follow-up: how does your approach change under tight memory constraints or when the integer range is bounded?
- On an m by n grid starting at the top-left cell, you move counterclockwise cycling through right, up, left, down. Each move skips one cell and lands two cells away in the current direction. The skipped cell stays unvisited. If the landing cell is out of bounds or already visited, rotate 90 degrees counterclockwise and try again. Stop when all four directions are blocked. Return the last visited cell's coordinates, and analyze the time and space complexity of your solution.
“Kadane's algorithm, pretty standard.”