Datadog logo

Datadog Software Engineer Interview Questions

18 practice questions for Datadog Software Engineer interviews

Datadog software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Easy Verified Question #1

1. Response Time Histogram


Category: Array coding problem
You are given a sorted (ascending) array of response times in milliseconds, a fixed bucket width, and a total number of buckets. Distribute the...
Input: Array
Output: Array
Want to practise this one?
Create a free account to open the full question and practise Datadog questions with AI.
Sign up free
coding Medium Verified Question #2

2. Event Window Aggregator


Category: String coding problem
You are given a list of sensor readings. Each reading has a list of labels, a timestamp, and a numeric value. You are also given a target label and...
Input: Array of strings
Output: Array
coding Easy Verified Question #3

3. Sensor Reading Interpolator


Category: Algorithm coding problem
You are given a sorted list of sensor readings, where each reading is a pair [time, measurement]. The readings are sorted by time in ascending order....
Input: List
Output: Computed result
coding Easy Verified Question #4

4. Label Co-occurrence Finder


Category: String coding problem
You are given a list of label groups and a list of required labels. Each group is a list of strings. A group is considered valid if it contains every...
Input: Array of strings
Output: Array
coding Medium Verified Question #5

5. Denomination Breakdown


Category: Array coding problem
You are given a list of distinct positive integer denominations and a target amount. Find the minimum total number of denominations needed to sum...
Input: Array
Output: Integer
coding Medium Verified Question #6

6. Asset Tree Size


Category: Tree coding problem
You are given a list of asset nodes representing a tree structure and a target path. Each node has a name, an optional size (present only for leaf...
Input: List
Output: Computed result
coding Medium Verified Question #7

7. Storage Cleaner


Category: Trie-based coding problem
You are implementing a recursive storage cleaner. Given a filesystem represented as a dictionary and a starting path, delete all files and...
Input: Array of strings
Output: Computed result
coding Medium Verified Question #8

8. Stream Pattern Matcher


Category: Algorithm coding problem
You are processing a stream of mixed input lines. Each line is either a pattern registration or an event log entry. - A pattern line starts with `P:...
Input: List
Output: Printed output
coding Medium Verified Question #9

9. Packet Buffer


Category: String coding problem
Design a PacketBuffer class that manages a fixed-capacity in-memory buffer for incoming data. Data is flushed to disk in chunks when the buffer...
Input: String
Output: Integer
coding Hard hash map #1

1. [Hash Map] — Match streaming logs against dynamically registered queries


Background
Datadog Log Management processes logs that engineers search to investigate incidents and monitor services. This exercise models the matching core of a live log subscription system: queries are registered before logs arrive, and each incoming log must be routed to the matching subscriptions.
Problem statement
Implement a LogQueryMatcher that processes query registrations, cancellations, and log messages in call order.
A token is a maximal contiguous sequence of ASCII letters or digits, normalized to lowercase. All other characters are separators. For example, ERROR: db-42 produces the tokens error, db, and 42.
A query matches a log if every distinct token in the query occurs somewhere in the log. Token order and repetition do not matter, and matching uses whole tokens rather than substrings. Thus, database timeout matches TIMEOUT connecting to database, but error does not match errors.
Each registration receives a unique, monotonically increasing integer ID, starting at 1. Identical queries registered separately receive different IDs and remain independent. A cancellation deactivates only the specified ID. For each log, return all matching active IDs in ascending order. Logs are not retained or matched against future registrations.
The query population is large, while most logs share tokens with only a small fraction of queries. Your implementation must use a searchable index rather than scan every active query for each log. Cancellation must also avoid scanning unrelated queries. Query cancellation is an extension to the reported registration-and-log-matching exercise.
Function or class signature
  • LogQueryMatcher() — construct an empty matcher.

  • register(query: str) -> int — register a query and return its new ID.

  • unregister(query_id: int) -> bool — deactivate an active ID and return true; return false if it is unknown or already inactive.

  • match(log: str) -> list[int] — return matching active IDs in ascending order.


Example 1:
Input:
[
  {"method": "register", "query": "database timeout"},
  {"method": "register", "query": "ERROR"},
  {"method": "register", "query": "timeout timeout"},
  {"method": "match", "log": "ERROR: database connection TIMEOUT"},
  {"method": "match", "log": "database errors"}
]
Output:
[1, 2, 3, [1, 2, 3], []]
Explanation: The first log contains every required token of all three queries. Repeated timeout tokens in query 3 count only once. The second log lacks timeout, and errors is not the token error.
Example 2:
Input:
[
  {"method": "register", "query": "api-500"},
  {"method": "register", "query": "500 API"},
  {"method": "match", "log": "api returned 500; API retry"},
  {"method": "unregister", "query_id": 1},
  {"method": "unregister", "query_id": 1},
  {"method": "match", "log": "API 500"},
  {"method": "register", "query": "api"},
  {"method": "match", "log": "api500"},
  {"method": "match", "log": "api"}
]
Output:
[1, 2, [1, 2], true, false, [2], 3, [], [3]]
Explanation: Queries 1 and 2 have the same token set but independent IDs. Cancelling query 1 leaves query 2 active. IDs are never reused. The token api500 is neither api nor 500, so it matches no active query.
Constraints:
  • At most 200,000 total method calls per matcher instance.

  • Each query contains 1–256 ASCII characters and at least one token.

  • Each log contains 0–10,000 ASCII characters; a log with no tokens matches nothing.

  • The total length of all query and log arguments is at most 20,000,000 characters.

  • The sum of distinct-token counts across active queries is at most 1,000,000.

  • Cancellation IDs are integers in the range 1 through 1,000,000,000.

  • Calls are sequential; thread safety is not required.


Follow-up:
A common token such as error now occurs in nearly every query and log, making its posting list expensive to visit. How would you index each query under one selected anchor token, verify candidates against their complete token sets, and choose or rebalance anchors as token frequencies change? Explain how you preserve correctness and what worst-case work remains unavoidable.
Want to practise this one?
Create a free account to open the full question and practise Datadog questions with AI.
Sign up free
coding Hard trie #2

2. [AI Enabled Coding] Query-Aware Log Ingestion Budgets


Scenario
Datadog Log Management processes logs from many services within each customer organization. Build a simplified ingestion-policy evaluator that matches log messages against literal queries and enforces rolling byte budgets, helping operators keep noisy services from consuming their indexing allowance. These are exercise-specific policies, not Datadog's actual billing rules; you may use an AI assistant while implementing and testing your solution.
Part 1 — Default service budgets
  • Each input record is a map with string keys and string values: id, timestamp_ms, organization, service, message, and bytes. bytes is the supplied ingestion weight, not the length of message.

  • Process records by increasing numeric timestamp_ms, breaking ties by their original input position. Return results in processing order.

  • Match queries as case-sensitive, contiguous literal substrings. A rule matches a record at most once, even if its query occurs repeatedly.

  • Install two default rules: error matches ERROR and allows 100 bytes per service per organization over 1000 ms; timeout matches timeout and allows 60 bytes per service per organization over 1000 ms.

  • For a matching rule with window W, usage at time t is the sum of bytes from previously accepted records matching that rule and scope with timestamps in (t − W, t]. Previously processed records at timestamp t count; a record exactly at t − W does not.

  • A record with no matching rules is ignored. Otherwise, reject it if current_usage + bytes > limit for any matching rule. Equality is allowed. An accepted record consumes its full byte weight in every matching rule; a rejected or ignored record consumes nothing.

  • For this stage, expose each record's ID and status: accepted, rejected, or ignored.


Function signature: evaluate_logs(logs: list[dict[str, str]]). The return type is up to you; the examples use JSON arrays of result objects.
Example 1:
Input:
{
  "logs": [
    {"id":"a","timestamp_ms":"0","organization":"acme","service":"api","message":"ERROR database","bytes":"60"},
    {"id":"b","timestamp_ms":"100","organization":"acme","service":"api","message":"ERROR timeout","bytes":"50"},
    {"id":"c","timestamp_ms":"200","organization":"acme","service":"api","message":"timeout upstream","bytes":"40"},
    {"id":"d","timestamp_ms":"300","organization":"acme","service":"api","message":"INFO healthy","bytes":"20"},
    {"id":"e","timestamp_ms":"1000","organization":"acme","service":"api","message":"ERROR timeout","bytes":"20"}
  ]
}

Output:
[
  {"id":"a","status":"accepted"},
  {"id":"b","status":"rejected"},
  {"id":"c","status":"accepted"},
  {"id":"d","status":"ignored"},
  {"id":"e","status":"accepted"}
]

Explanation: a consumes 60 error bytes. b would bring error usage to 60 + 50 = 110 > 100, so it consumes neither error nor timeout budget. c consumes 40 timeout bytes. d matches neither query. At time 1000, a has expired: e brings error usage to 20 and timeout usage to 40 + 20 = 60, so both limits pass.
Part 2 — Organization policies and explainable decisions
Other teams now need to install additional literal-query rules, including organization-wide budgets shared by different services. Extend, rather than replace, Part 1: both default rules always remain active.
  • Add evaluate_logs_with_rules(logs: list[dict[str, str]], additional_rules: list[dict[str, str]]). Each additional rule has string fields id, query, scope, limit_bytes, and window_ms. scope is either service or organization; a service scope is keyed by both organization and service, while an organization scope is keyed only by organization.

  • Apply the same matching, rolling-window, and all-or-nothing acceptance semantics to every rule. A record matching only an additional rule is eligible for acceptance. Each rule has an independent budget, even when two rules have identical queries.

  • Return every matching rule ID and all violations, rather than stopping at the first failure. Sort matched_rules and violations lexicographically by rule ID. Each violation contains rule_id, used_bytes before this record, attempted_bytes equal to used_bytes + record.bytes, and limit_bytes. Accepted and ignored records have an empty violations list.

  • Discuss how your return type changes before implementing this stage. Keep matching, scope selection, rolling accounting, and result formatting sufficiently separate to support future additions of these policy kinds without rewriting the evaluator.

  • Target up to 10,000 additional queries: scanning every query against every message is not an acceptable final approach. Explain your output-sensitive matching complexity, including repeated substring occurrences.


Example 2:
Input:
{
  "additional_rules": [
    {"id":"org_errors","query":"ERROR","scope":"organization","limit_bytes":"120","window_ms":"1000"}
  ],
  "logs": [
    {"id":"a","timestamp_ms":"0","organization":"acme","service":"api","message":"ERROR","bytes":"70"},
    {"id":"b","timestamp_ms":"100","organization":"acme","service":"worker","message":"ERROR","bytes":"40"},
    {"id":"c","timestamp_ms":"200","organization":"acme","service":"api","message":"ERROR","bytes":"20"},
    {"id":"d","timestamp_ms":"300","organization":"acme","service":"worker","message":"timeout","bytes":"50"},
    {"id":"e","timestamp_ms":"1000","organization":"acme","service":"api","message":"ERROR timeout","bytes":"30"}
  ]
}

Output:
[
  {"id":"a","status":"accepted","matched_rules":["error","org_errors"],"violations":[]},
  {"id":"b","status":"accepted","matched_rules":["error","org_errors"],"violations":[]},
  {"id":"c","status":"rejected","matched_rules":["error","org_errors"],"violations":[{"rule_id":"org_errors","used_bytes":110,"attempted_bytes":130,"limit_bytes":120}]},
  {"id":"d","status":"accepted","matched_rules":["timeout"],"violations":[]},
  {"id":"e","status":"accepted","matched_rules":["error","org_errors","timeout"],"violations":[]}
]

Explanation: a and b use different service budgets but together consume 70 + 40 = 110 organization error bytes. For c, the service error total would be 70 + 20 = 90, but the organization total would be 110 + 20 = 130 > 120; it is rejected without changing either budget. d consumes 50 timeout bytes only for worker. At time 1000, a expires: e produces service error usage 30, organization error usage 40 + 30 = 70, and api timeout usage 30.
Example 3:
Input:
{
  "additional_rules": [
    {"id":"org_errors","query":"ERROR","scope":"organization","limit_bytes":"120","window_ms":"1000"},
    {"id":"org_timeouts","query":"timeout","scope":"organization","limit_bytes":"50","window_ms":"1000"}
  ],
  "logs": [
    {"id":"a","timestamp_ms":"0","organization":"acme","service":"api","message":"ERROR timeout","bytes":"40"},
    {"id":"b","timestamp_ms":"100","organization":"acme","service":"worker","message":"ERROR","bytes":"80"},
    {"id":"c","timestamp_ms":"200","organization":"acme","service":"api","message":"ERROR timeout","bytes":"70"},
    {"id":"d","timestamp_ms":"1000","organization":"acme","service":"api","message":"ERROR timeout","bytes":"20"},
    {"id":"e","timestamp_ms":"1100","organization":"acme","service":"api","message":"ERROR timeout","bytes":"40"}
  ]
}

Output:
[
  {"id":"a","status":"accepted","matched_rules":["error","org_errors","org_timeouts","timeout"],"violations":[]},
  {"id":"b","status":"accepted","matched_rules":["error","org_errors"],"violations":[]},
  {"id":"c","status":"rejected","matched_rules":["error","org_errors","org_timeouts","timeout"],"violations":[{"rule_id":"error","used_bytes":40,"attempted_bytes":110,"limit_bytes":100},{"rule_id":"org_errors","used_bytes":120,"attempted_bytes":190,"limit_bytes":120},{"rule_id":"org_timeouts","used_bytes":40,"attempted_bytes":110,"limit_bytes":50},{"rule_id":"timeout","used_bytes":40,"attempted_bytes":110,"limit_bytes":60}]},
  {"id":"d","status":"accepted","matched_rules":["error","org_errors","org_timeouts","timeout"],"violations":[]},
  {"id":"e","status":"rejected","matched_rules":["error","org_errors","org_timeouts","timeout"],"violations":[{"rule_id":"org_timeouts","used_bytes":20,"attempted_bytes":60,"limit_bytes":50}]}
]

Explanation: a consumes 40 bytes in four independent budgets. b brings organization error usage to 40 + 80 = 120. c violates all four matching rules: 40 + 70 = 110 > 100, 120 + 70 = 190 > 120, 40 + 70 = 110 > 50, and 40 + 70 = 110 > 60. At time 1000, a expires, so d produces totals of 20 service-error bytes, 80 + 20 = 100 organization-error bytes, 20 organization-timeout bytes, and 20 service-timeout bytes. At time 1100, b expires; e would produce 60 bytes in each matching budget, exceeding only the organization-timeout cap of 50. Its rejection changes no budget.
Notes:
  • Inputs are valid ASCII strings; record IDs are unique, and additional rule IDs are unique and distinct from error and timeout. Queries are nonempty. Every function call starts with empty usage state.

  • There are at most 200,000 records and 10,000 additional rules, with at most 2,000,000 message characters and 200,000 additional-query characters in total. Timestamps are integers in [0, 10^15]; weights, limits, and windows are integers in [1, 10^9], encoded as strings.

  • This is a single-process batch problem. Input may be unsorted; distributed coordination, actual log parsing, and concurrent updates are out of scope.
coding Medium hash map #3

3. Coding — Implement Log Query Logic

Background: Datadog handles vast amounts of log data from various services and applications. Implementing basic query logic is essential for Datadog's observability platform to efficiently filter and analyze logs.
Problem statement: You are tasked with implementing a function that processes a list of log entries and allows querying these logs based on specific filters. Each log entry is represented by a dictionary with attributes such as timestamp, level, and message. Create a function query_logs(logs: List[Dict[str, Any]], level: str) -> List[Dict[str, Any]] that returns all logs of a specific level.
Function/class signature:
  • def query_logs(logs: List[Dict[str, Any]], level: str) -> List[Dict[str, Any]]:

Example 1:
  • Input:

logs = [
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'info', 'message': 'Service started'},
    {'timestamp': '2023-10-01T12:01:00Z', 'level': 'error', 'message': 'Service failed'},
    {'timestamp': '2023-10-01T12:02:00Z', 'level': 'info', 'message': 'Service running'}
]
level = 'info'

  • Output:

[
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'info', 'message': 'Service started'},
    {'timestamp': '2023-10-01T12:02:00Z', 'level': 'info', 'message': 'Service running'}
]

  • Explanation: The function filters the logs and returns only the entries with the info level.

Example 2:
  • Input:

logs = [
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'warning', 'message': 'Low disk space'},
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'error', 'message': 'Unauthorized access'},
]
level = 'error'

  • Output:

[
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'error', 'message': 'Unauthorized access'}
]

  • Explanation: The function returns the logs with the error level only.

Constraints:
  • 1 <= length of logs <= 10^4

  • level is guaranteed to be one of ['info', 'warning', 'error']
coding Medium hash map #4

4. [Hash Map] — Find the latest metrics for a given service

Background: At Datadog, keeping track of service metrics in real-time is crucial for observability. Handling multiple services and their metrics efficiently allows users to monitor performance and identify issues promptly.
Problem statement: You are tasked with implementing a function that retrieves the latest metric value for a given service based on a list of metric records. Each record contains a timestamp and the service name. If the service has no recorded metrics, return None. The function should return the latest timestamp and its corresponding value for that service.
Function signature:
  • def latest_metric(metrics: List[Tuple[str, str, float]], service_name: str) -> Optional[Tuple[str, float]]:


Example 1:
  • Input: latest_metric([('2023-01-01T12:00:00', 'serviceA', 1.0), ('2023-01-01T12:05:00', 'serviceA', 1.5), ('2023-01-01T12:02:00', 'serviceB', 0.5)], 'serviceA')

  • Output: ('2023-01-01T12:05:00', 1.5)

  • Explanation: The latest entry for serviceA is from 2023-01-01T12:05:00 with a metric value of 1.5.


Example 2:
  • Input: latest_metric([('2023-01-01T12:00:00', 'serviceA', 1.0)], 'serviceB')

  • Output: None

  • Explanation: No metrics were recorded for serviceB.


Constraints:
  • 1 ≤ len(metrics) ≤ 1000

  • Each timestamp is a valid ISO 8601 formatted string.

  • Metric values can be any float.

  • Service names are non-empty strings.


coding Medium hash map #5

5. [Hash Map] — Finding the Frequency of Metrics

Background: In the context of Datadog's monitoring platform, it is crucial to accurately analyze the frequency of various metrics reported over a time frame. This operation aids in optimizing resource allocation and identifying anomalies in system performance.
Problem statement: Given a list of metrics represented as strings and a time frame as an integer, write a function called find_metrics_frequency that returns a dictionary recording the frequency of each metric within that time frame. If a metric appears more than once, it should be counted accordingly.
Function/class signature:
  • def find_metrics_frequency(metrics: List[str], time_frame: int) -> Dict[str, int]:

Example 1:
Input: metrics = ['cpu', 'memory', 'cpu', 'disk', 'memory'], time_frame = 5
Output: {'cpu': 2, 'memory': 2, 'disk': 1}
Explanation: Within the provided list of metrics, 'cpu' and 'memory' each appear twice, while 'disk' appears once.
Example 2:
Input: metrics = ['requests', 'errors', 'errors', 'cpu'], time_frame = 4
Output: {'requests': 1, 'errors': 2, 'cpu': 1}
Constraints:
  • 1 <= len(metrics) <= 10^6

  • Each metric is a string with length at most 100 characters.
coding Medium database #6

6. CODING — Implement a Metrics Monitoring System


Background: Datadog requires a robust metrics monitoring system to optimize the performance and reliability of its observability platform. This involves processing large quantities of time-series data efficiently.
Problem statement: Implement a class MetricsMonitor to handle the storage and retrieval of metrics. The system should support adding metrics, retrieving the average of a metric over a specified time window, and removing metrics older than a given time. The add_metric function should store metrics with a timestamp, while the get_average should compute the average of metrics in the specified time window created from a given timestamp. The remove_old_metrics will eliminate metrics older than a certain threshold.
Function/class signature:
  • def add_metric(name: str, value: float, timestamp: int) -> None:

  • def get_average(name: str, current_time: int, time_window: int) -> float:

  • def remove_old_metrics(current_time: int, threshold: int) -> None:


Example 1:
Input: add_metric("cpu_usage", 30.5, 1609459200)
Output: None
Explanation: A metric for "cpu_usage" with value 30.5 at timestamp 1609459200 was added.
Example 2:
Input: get_average("cpu_usage", 1609459260, 300)
Output: 30.5
Explanation: The average over the last 300 seconds (from timestamp 1609459260) retrieves the previously stored metric value.
Constraints:
  • 0 < timestamp <= 10^9

  • -1000 <= value <= 1000

  • 0 < time_window <= 3600

  • The system can store up to 10^6 metrics.
coding Medium array #7

7. CODING — Calculate Latency Buckets

Background: Datadog handles vast amounts of performance metrics and monitoring data. Analyzing latency metrics is crucial for performance optimization and identifying bottlenecks in systems.
Problem statement: You are given a list of latencies (in milliseconds), a number of buckets, and a bucket_width. Your task is to calculate how frequently each range of latencies occurs. Each bucket covers a width of bucket_width. For example, if the latencies are [10, 20, 30, 20, 15], buckets is 5, and bucket_width is 10, your output should reflect the count of latencies that fall within the respective ranges (0-10, 10-20, etc.).
Function/class signature:
  • def calculate_latency_buckets(latencies: List[int], buckets: int, bucket_width: int) -> List[int]:

Example 1:
  • Input: latencies = [10, 20, 30, 20, 15], buckets = 5, bucket_width = 10

  • Output: [1, 3, 1, 0, 0]

  • Explanation: In the ranges: 0-10 (1), 10-20 (3), 20-30 (1), 30-40 (0)

Example 2:
  • Input: latencies = [1, 12, 25, 3, 30], buckets = 5, bucket_width = 10

  • Output: [2, 1, 1, 1, 0]

Constraints:
  • 1 <= len(latencies) <= 10^4

  • 1 <= latencies[i] <= 10^6

  • 1 <= buckets <= 100

  • 1 <= bucket_width <= 100

coding Medium time #8

8. CODING — Parse and Calculate Real-Time Statistics for Time-Series Events

1. Background: Datadog specializes in monitoring and observability of cloud applications. Accurate parsing and computation of real-time event statistics are crucial for understanding system performance and utilization.
2. Problem statement: You need to maintain a time-series database that stores events occurring at specific timestamps. Write a function that takes a list of events with their timestamps and window size (in seconds), then returns the statistics over the last specified window size for each event. The statistics should include the sum, count, and average of the events within the time window, inclusive of the current event.
3. Function/class signature:
- def calculate_statistics(events: List[Tuple[int, float]], window_size: int) -> List[Tuple[float, int, float]]:
4. Example 1:
- Input: [(1, 10), (2, 20), (3, 30), (4, 40)], window_size=2
- Output: [(10.0, 1, 10.0), (30.0, 2, 15.0), (60.0, 3, 20.0), (40.0, 1, 40.0)]
- Explanation: Event (2, 20) includes (1, 10) and itself; the total is 30 with 2 events averaging to 15.
5. Example 2:
- Input: [(1, 15), (3, 25), (5, 35)], window_size=3
- Output: [(15.0, 1, 15.0), (25.0, 1, 25.0), (35.0, 1, 35.0)]
6. Constraints:
- 1 <= len(events) <= 10^6
- 0 <= events[i][0] <= 10^9
- 0 <= events[i][1] <= 10^9
- 1 <= window_size <= 10000

coding Medium two pointers #9

9. Two Pointers — Finding Unique Metrics within Time Window

Background: Datadog's system monitors various metrics over time and efficiently processes them to identify unique metrics within specified time frames. This is crucial for real-time performance monitoring.
Problem statement: Given a list of metrics represented as strings and an integer timeWindow, return a list of unique metrics that appear in the last timeWindow elements of the list. The result should maintain the order of first appearances in the time window.
Function/class signature:
  • def unique_metrics(metrics: List[str], timeWindow: int) -> List[str]:

Example 1:
  • Input: metrics = ['cpu', 'memory', 'disk', 'cpu', 'network', 'memory'], timeWindow = 4

  • Output: ['disk', 'cpu', 'network', 'memory']

  • Explanation: Within the last 4 metrics, 'cpu', 'network', and 'memory' are unique metrics appearing in their order of first appearance.

Example 2:
  • Input: metrics = ['cpu', 'cpu', 'memory', 'disk'], timeWindow = 2

  • Output: ['memory', 'disk']

  • Explanation: The last two metrics are 'cpu', 'cpu', and the unique metrics after excluding duplicates are 'memory' and 'disk'.

Constraints:
  • 1 ≤ len(metrics) ≤ 1000

  • 1 ≤ timeWindow ≤ len(metrics)

  • Each metric string is unique within the complete list but may repeat within the time window.

Related Datadog Software Engineer interview prep

Start practicing Datadog questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free