← Ramp Interview Insights

Ramp·Frontend Engineer·Online Assessment (OA)·Intermediate

Intermediate
Apr 2026Remote

Summary

Ramp frontend engineering challenge where the task was to locate and retrieve a hidden flag value from either the DOM or a URL response. Pretty practical exercise, less algorithmic than I expected.

Questions Asked (1)

Q1

Given either a DOM fixture with a hidden flag embedded in the markup or a URL whose response contains the flag, write code to retrieve the flag value regardless of which source it comes from.

API & IntegrationsTechnical Trade-offs
Author's notes

The DOM side was fine, querySelector and dataset access are muscle memory at this point.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the two possible sources: a DOM fixture with a hidden flag or a URL whose response contains the flag. Then design a function that abstracts the retrieval logic, using DOM parsing for the fixture and fetch for the URL, with a unified interface to extract the flag value.

Pro tip: Demonstrate awareness of security and performance: avoid hardcoding the flag, handle errors gracefully, and consider caching or memoization if the flag is fetched multiple times.

1. Clarify requirements and constraints

Ask whether the flag is always in a specific format (e.g., 'flag{...}') and whether the source is known at runtime or must be auto-detected. Confirm if the function should be synchronous or asynchronous.

2. Design a unified interface

Create a function that accepts either a DOM element or a URL string, and returns a Promise that resolves to the flag value. Use feature detection or type checking to determine the source.

3. Implement DOM extraction

For a DOM fixture, use querySelector or traverse the DOM to find the hidden flag. Consider that the flag might be in an attribute, text content, or comment.

4. Implement URL fetching

For a URL, use fetch to retrieve the response, then parse the text (or JSON) to extract the flag. Handle network errors and non-200 responses.

5. Extract and return the flag

Use a regular expression or string manipulation to isolate the flag from the raw content. Return it in a consistent format, and consider edge cases like missing flag.

Key Points to Mention

  • Asynchronous handling: use async/await or Promises for URL fetching, and ensure DOM extraction is synchronous but wrapped appropriately.
  • Error handling: gracefully handle cases where the flag is not found or network requests fail.
  • Security: avoid exposing the flag in logs or client-side storage; sanitize inputs if necessary.
  • Performance: minimize DOM traversal and network calls; consider caching the flag if retrieved repeatedly.
  • Code organization: separate concerns into helper functions for DOM parsing and HTTP fetching.
  • Testing: write unit tests for both scenarios, mocking fetch and DOM fixtures.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.