Company: Apple

Difficulty: medium

Problem Statement

Shared Station Path On the iPhone final assembly line, every unit is scanned at each station it passes through. A unit's station path is recorded as a string of lowercase letters -- one letter per station, in the order the unit visited them. Station codes on this line: Code Station a antenna flex attach b battery bonding c camera module install d display lamination e end-of-line RF test f - z other stations on the line Units do not all follow the same path. A rework unit re-entering the line skips stations that already passed; a unit diverted for a defect may loop back through a station a second time. But two units that were built correctly should still share a common processing history: the same stations, visited in the same relative order , even if other stations appear in between. Given the station paths of two units, path_a and path_b , return the length of the longest shared station path -- the longest sequence of stations appearing in both paths in the same relative order. A shar

More Apple OA questionsInterview experiences