Hidden Artifacts
Updated
Problem statement
An archaeological site is represented by an n-by-n grid. Rows are numbered from 1 through n, and columns are labeled from A through the nth uppercase letter. A cell is written as its row followed by its column, such as 9C.
Each hidden artifact occupies an axis-aligned rectangular group of cells. Artifacts do not overlap, and each artifact has area at most 4.
The string artifacts contains comma-separated artifact descriptors. Each descriptor has the form topLeft bottomRight. The string searched contains distinct searched cells separated by spaces.
An artifact is fully reconstructed when every cell it occupies has been searched. It is partially found when at least one, but not all, of its cells have been searched. Return an integer array [fullyReconstructed, partiallyFound].
Function
findHiddenArtifacts(n: int, artifacts: String, searched: String) → int[]Examples
Example 1
n = 4artifacts = "1B 2C, 2D 4D"searched = "2B 2D 3D 4D 4A"return = [1,1]The vertical artifact from 2D through 4D is fully reconstructed. The 2-by-2 artifact has only cell 2B found, so it is partial.
Example 2
n = 3artifacts = "1A 1B, 2C 2C"searched = "1B"return = [0,1]Only one cell of the first artifact has been found, and the single-cell artifact at 2C has not been found.
Constraints
1 <= n <= 26- Every artifact descriptor names the valid top-left and bottom-right cells of an axis-aligned rectangle.
- Each artifact occupies at most
4cells. - No grid cell belongs to more than one artifact.
- Every cell in
searchedis valid and appears at most once. - Artifact descriptors and searched cells may appear in any order.
More IMC Trading Online Assessment questions
- Earliest Meeting Start on a 24-Hour ClockOA · Seen Nov 2026
- Grid Paths with Override PassesOA · Seen Oct 2026
- Weighted LFU CacheOA · Seen Sep 2026
- Rock JumpingOA · Seen Aug 2026
- Stack Batch RemovalOA · Seen Aug 2026
- Chain of CommandOA · Seen Aug 2026
- Choose ContainersOA · Seen Aug 2026
- Sub-matrix SumsOA · Seen Jul 2026
- Sub-matrix SumsOA · Seen Jul 2026
- Can Every Package Fit in a BoxOA · Seen Jul 2026
Similar questions at other companies
- Incident MonitorStripe · OAStripe interview questions
- Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
- Dictionary Records to an Editable XML TreeSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
- Machine Message RouterOpenAI · PHONE SCREENOpenAI interview questions
- JSON Identity VerificationKikoff · PHONE SCREENKikoff interview questions
- Parcel Event TrackingAirbnb · OAAirbnb interview questions
- Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
- First Completed Mingo LineEpic · OAEpic interview questions
- Inventory Discount TrackerRoblox · OARoblox interview questions
- Cheating CodemakerJane Street · OAJane Street interview questions