Meta .NET Developer Interview Questions & Answers

meta icon

Questions with Detailed ExplanationsWith Detailed Explanations

(Last Updated: August 28, 2026)

11. Weighted KeysCodingHardMeta

Question Details

Rank keys by weighted frequency and describe how you would handle collisions and tie scores.

Short Interview Answer (30-60 seconds)

I would first use a dictionary to add all weights for each key. Then I would sort the distinct keys by total weight descending. If two totals are equal, I would sort those keys in ascending ordinal lexicographic order. Dictionary equality checks keep different keys separate even when their hash codes collide. The expected time is O(n + m log m), where m is the number of distinct keys, and the auxiliary space is O(m).

Detailed Explanation

See the Code while reading this explanation.

The input contains pairs of a text key and a numeric weight. The same key can appear more than once. We first add all weights that belong to the same key. Then we rank the distinct keys from the largest total weight to the smallest. When two totals are equal, we order those keys by ascending ordinal lexicographic order. A dictionary is a good fit because it keeps one running total for each key. After aggregation, we only need to sort the distinct dictionary entries.

Useful Questions to Ask the Interviewer
  1. Should equal totals use case-sensitive ordinal string ordering?
  2. Can weights be negative or zero?
  3. Can the input be empty?
  4. Can accumulated totals be large enough to require long?
Weighted Keys diagram
How to Explain It in an Interview
1. Understand the input and output

The input is a sequence of pairs. Each pair contains a string key and a numeric weight. The output contains each distinct key once. Keys with larger accumulated weights come first. If two keys have the same accumulated weight, their keys are compared in ascending ordinal lexicographic order.

For the diagram example, the input is (apple, 3), (banana, 2), (apple, 5), (carrot, 4), (banana, 2), and (date, 4). The final output is apple, banana, carrot, date.

2. Choose the data structure

Use a Dictionary<string, long> called weightByKey. Each dictionary key is one input key. Its value is the running total of all weights seen for that key.

The central invariant is: after processing any prefix of the input, weightByKey stores the exact accumulated weight for every key seen in that prefix. Repeated keys update the same entry. If two different keys happen to have the same hash bucket, Dictionary still keeps them separate by checking key equality.

3. Aggregate the weights

Start with an empty dictionary.

Process (apple, 3). Apple is new, so its total becomes 3.

Process (banana, 2). Banana is new, so its total becomes 2.

Process (apple, 5). Apple already has 3, so its total becomes 3 + 5 = 8.

Process (carrot, 4). Carrot is new, so its total becomes 4.

Process (banana, 2). Banana already has 2, so its total becomes 2 + 2 = 4.

Process (date, 4). Date is new, so its total becomes 4.

The final totals are apple = 8, banana = 4, carrot = 4, and date = 4.

4. Sort the distinct keys

Sort the dictionary entries by total weight descending. Apple comes first because 8 is larger than 4. Banana, carrot, and date all have total 4, so the tie rule is used. Ascending ordinal lexicographic order gives banana before carrot before date.

The final ranked result is apple, banana, carrot, date.

5. Explain why the result is correct

The dictionary invariant guarantees that each stored value is the sum of all processed weights for its key. After the complete input has been processed, every stored total is final. Sorting by total descending gives the required weighted ranking. Applying the ordinal key comparison only when totals are equal gives the required tie order. Therefore the returned keys follow both ranking rules.

6. Explain the C# implementation

The method receives IEnumerable<(string Key, long Weight)>. It creates a Dictionary<string, long>. For each pair, it creates a zero total when the key is first seen, then adds the current weight. After aggregation, OrderByDescending sorts entries by total weight. ThenBy with StringComparer.Ordinal resolves equal totals by key. Select keeps only the keys, and ToList returns the ranked list.

7. Explain complexity and edge cases

Let n be the number of input items and m be the number of distinct keys. Dictionary lookup and insertion are O(1) on average, so aggregation takes O(n) expected time. Sorting m distinct entries costs O(m log m). The total expected time is O(n + m log m). Auxiliary space is O(m).

An empty input returns an empty list. Repeated keys accumulate into one total. Zero and negative totals still follow descending numeric order. Equal totals use ordinal lexicographic ascending order. The code uses long for larger accumulated totals.

Key Insight / Why This Solution Works

Use two phases. First, aggregate every occurrence of the same key into one running total in a Dictionary<string, long>. The invariant is that after each processed item, the dictionary contains the exact accumulated weight seen so far for every key. Repeated keys update their existing total. Hash collisions do not combine different keys because Dictionary uses equality checks to distinguish them. Second, sort the distinct dictionary entries by total weight descending and then by key with StringComparer.Ordinal ascending. Finally, return only the keys.

Code
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
    public static List<string> RankByWeightedFrequency(IEnumerable<(string Key, long Weight)> items)
    {
        // Keep one accumulated total for every distinct key.
        Dictionary<string, long> weightByKey = new Dictionary<string, long>();

        foreach ((string key, long weight) in items)
        {
            // Start a new key at zero before adding its first weight.
            // Dictionary resolves hash collisions by checking key equality,
            // so different keys remain separate entries.
            if (!weightByKey.ContainsKey(key))
            {
                weightByKey[key] = 0L;
            }

            // Add this occurrence to the running total for the key.
            weightByKey[key] += weight;
        }

        // Sort larger totals first. When totals tie, compare keys
        // with ordinal lexicographic ascending order.
        List<string> ranked = weightByKey.OrderByDescending(kv => kv.Value)
                                  .ThenBy(kv => kv.Key, StringComparer.Ordinal)
                                  .Select(kv => kv.Key)
                                  .ToList();

        // Return each distinct key once in its final ranked position.
        return ranked;
    }

    public static void Main()
    {
        // Use the exact verified example from the diagram.
        (string Key, long Weight)[] input = { ("apple", 3),  ("banana", 2), ("apple", 5),
                                              ("carrot", 4), ("banana", 2), ("date", 4) };

        // Aggregate the weights and rank the distinct keys.
        List<string> result = RankByWeightedFrequency(input);

        // Expected output: apple, banana, carrot, date
        Console.WriteLine(string.Join(", ", result));
    }
}
Time & Space Complexity

Let n be the number of input items and m be the number of distinct keys. Dictionary lookup and insertion are O(1) on average, so building the totals takes O(n) expected time. Sorting the m distinct entries takes O(m log m). Therefore the complete expected time is O(n + m log m). The dictionary and ranked result grow with the number of distinct keys, so the auxiliary space is O(m). Dictionary performance depends on average hash-table behavior, not guaranteed constant-time worst-case operations.

Where it is used

This pattern is useful when repeated keyed records must be combined and then ranked. Examples include weighted activity scores, search-term ranking, user score aggregation, product ranking, and category scoring. The same approach works when many input records share keys but the final output needs one ranked entry per distinct key.

Why Interviewers Ask This

This question tests whether a candidate can aggregate repeated keyed data correctly and then apply a multi-key ranking rule. It checks dictionary usage, repeated-key handling, hash-collision understanding, deterministic tie handling, and correct C# sorting. It also tests whether the candidate can explain the invariant behind the running totals and give accurate complexity that includes both expected hash-table operations and the O(m log m) sorting step.

Common interview mistakes

A common mistake is sorting the original input records before first combining repeated keys. Another is replacing a previous weight instead of adding to the running total. A candidate may also forget the secondary ordering rule and leave equal totals in an unspecified order. Another mistake is assuming a hash collision means two different keys should be combined. Dictionary still compares keys for equality. Finally, claiming O(n) total time is incorrect because sorting the m distinct keys costs O(m log m).

Interview tip

State the two ordering rules before writing code: total weight descending first, then key ascending with StringComparer.Ordinal for equal totals. Then explain that the dictionary produces exactly one accumulated total per distinct key. This makes the correctness argument and the final LINQ ordering easy to verify.

Interviewer may ask next
How would this solution work if the input arrived as a stream?

The aggregation phase already works with streaming input. Each arriving pair updates weightByKey immediately, so the algorithm does not need to keep all n input records. It only keeps one total for each of the m distinct keys. When the stream ends, sort the dictionary entries using the same total-descending and ordinal-key-ascending rules. Correctness is unchanged because the dictionary invariant still holds after every item. The expected time is O(n + m log m), auxiliary space is O(m), and the final exact ranking is only available after the stream finishes.

What is the worst-case concern with Dictionary collisions?

Dictionary lookup and insertion are O(1) on average, but pathological hash behavior can make operations slower in the worst case. This does not change the ranking rule or correctness. Different keys that collide in the hash table are still distinguished by equality checks, so their totals stay separate. The sorting phase remains O(m log m), and auxiliary space remains O(m). The tradeoff is that the expected aggregation performance depends on normal hash-table behavior.

12. Scrambled TicketsCodingHardMeta

Question Details

Recover the ticket order from scrambled records and state the invariants that let you rebuild the sequence.

Short Interview Answer (30-60 seconds)

I would treat each scrambled ticket as a directed link from one place to the next. I build a dictionary from each source to its destination and a set containing every destination. The unique source that never appears in the destination set is the start. From there, I repeatedly follow the dictionary links until there is no outgoing record. I also verify that every ticket record was consumed exactly once. This takes O(n) expected time and O(n) auxiliary space.

Detailed Explanation

See the Code while reading this explanation.

The input is a scrambled collection of directed ticket records. Each record has a from place and a to place. The to place comes immediately after the from place in the final trip. We need to rebuild one continuous order from the first place to the last. The key idea is to find the only source that never appears as a destination. Then we follow each next connection until the trip ends. A dictionary gives fast successor lookups, and a set helps identify the unique start.

Useful Questions to Ask the Interviewer
  1. Can I assume a valid input should form one complete directed chain?
  2. Should I reject invalid data such as duplicate sources, cycles, or disconnected records?
  3. Should the returned result contain every endpoint from the first source through the final destination?
Scrambled Tickets diagram
How to Explain It in an Interview
1. Understand the input and required output

Each input record is a directed pair (from, to). It means to immediately follows from. The records can arrive in any order. We must return the complete endpoint sequence from the first endpoint to the last endpoint. In the diagram, the scrambled records are (SFO, LAX), (DEN, SEA), (LAX, DEN), and (SEA, BOS). The recovered order is SFO → LAX → DEN → SEA → BOS.

2. Choose the dictionary and destination set

I create nextByFrom, a dictionary that stores from → to. For the example, it contains SFO → LAX, LAX → DEN, DEN → SEA, and SEA → BOS. I also create a destination set containing {LAX, DEN, SEA, BOS}. The start is the unique source that does not appear in this destination set.

3. Find the unique start

I check every source stored in nextByFrom. SFO is the only source that does not appear in the destination set, so SFO is the start. If more than one source satisfies this condition, there is no unique chain start. If no source satisfies it, the records cannot form the required one-way chain from a unique starting endpoint.

4. Walk through the example

Start with SFO. The dictionary gives nextByFrom["SFO"] = "LAX", so the order becomes SFO → LAX. Next, nextByFrom["LAX"] = "DEN", so the order becomes SFO → LAX → DEN. Then nextByFrom["DEN"] = "SEA", giving SFO → LAX → DEN → SEA. Next, nextByFrom["SEA"] = "BOS", giving SFO → LAX → DEN → SEA → BOS. BOS has no outgoing record, so traversal stops.

5. Explain why the result is correct

The important invariants are the same ones shown in the diagram. Each source has at most one successor. Each non-start endpoint has one predecessor in a valid chain. Exactly one source never appears as a destination, and that source is the start. Following successors from the start forms one acyclic chain. Finally, the traversal must consume every input record exactly once. These properties make the reconstructed order unambiguous for a valid input.

6. Explain the C# implementation

The code builds nextByFrom with Dictionary<string, string> and stores destinations in HashSet<string>. TryAdd rejects a duplicate source because a valid chain cannot give one source more than one successor. The code then finds the unique dictionary key that is missing from the destination set. Starting there, it follows TryGetValue links, appends each destination, and counts how many records were consumed. A count larger than the dictionary size detects a cycle. A final count check rejects records that do not all belong to the reconstructed chain.

7. Explain complexity and edge cases

Building the dictionary and destination set takes O(n) expected time because Dictionary and HashSet operations are O(1) on average. Finding the start and following the chain also take O(n) expected time. Therefore, the overall expected time is O(n). The dictionary and set grow with the input, so auxiliary space is O(n). Relevant cases include a single record, a duplicate source, no unique start, a cycle, and disconnected records.

Key Insight / Why This Solution Works

The key insight is that the first endpoint appears as a source but never as a destination. I store every directed record in a dictionary called nextByFrom, where each key is a source and its value is the immediate destination. I also store every destination in a hash set. The unique dictionary key missing from the destination set is the start. From that start, repeatedly following nextByFrom[current] reconstructs the sequence. The central invariants are that each source has at most one successor, there is exactly one start, following successors forms one acyclic chain, and every input record is consumed exactly once.

Code
#nullable enable
using System;
using System.Collections.Generic;

public static class Program
{
    public static void Main()
    {
        // Use the exact scrambled example shown in the diagram.
        List<(string From, string To)> tickets =
            new() { ("SFO", "LAX"), ("DEN", "SEA"), ("LAX", "DEN"), ("SEA", "BOS") };

        // Reconstruct the full sequence from the unique start to the final endpoint.
        List<string> order = RecoverOrder(tickets);

        // Expected output: SFO → LAX → DEN → SEA → BOS
        Console.WriteLine(string.Join(" → ", order));
    }

    public static List<string> RecoverOrder(IEnumerable<(string From, string To)> tickets)
    {
        // Map each source endpoint to its one immediate successor.
        Dictionary<string, string> nextByFrom = new();

        // Store every destination so the unique source with no predecessor can be found.
        HashSet<string> destinations = new();

        foreach ((string from, string to) in tickets)
        {
            // A valid chain cannot give the same source more than one outgoing record.
            if (!nextByFrom.TryAdd(from, to))
            {
                throw new ArgumentException("Duplicate source.");
            }

            // Record that this endpoint appears as a destination.
            destinations.Add(to);
        }

        string? start = null;

        // The start is the unique source that never appears as a destination.
        foreach (string from in nextByFrom.Keys)
        {
            if (!destinations.Contains(from))
            {
                // Finding a second candidate means the records have no unique start.
                if (start != null)
                {
                    throw new ArgumentException("No unique start.");
                }

                start = from;
            }
        }

        // No candidate start means the records do not form the required chain.
        if (start == null)
        {
            throw new ArgumentException("No unique start.");
        }

        // The recovered endpoint sequence begins with the unique start.
        List<string> order = new() { start };
        string current = start;
        int usedRecords = 0;

        // Follow each from → to link until the final endpoint has no outgoing record.
        while (nextByFrom.TryGetValue(current, out string? next))
        {
            // Append the successor and advance the traversal state.
            order.Add(next);
            current = next;
            usedRecords++;

            // More traversed links than input records proves that a cycle was entered.
            if (usedRecords > nextByFrom.Count)
            {
                throw new ArgumentException("Cycle detected.");
            }
        }

        // Every input record must belong to the one reconstructed chain.
        if (usedRecords != nextByFrom.Count)
        {
            throw new ArgumentException("Records do not form one chain.");
        }

        return order;
    }
}
Time & Space Complexity

Let n be the number of ticket records. Building the dictionary and destination set takes O(n) expected time. Dictionary and HashSet lookup and insertion are O(1) on average, so the overall hashing-based bound is expected rather than guaranteed worst-case O(n). Finding the start takes O(n), and following the chain takes O(n). Overall expected time is O(n). The dictionary and destination set can each hold O(n) values, so auxiliary space is O(n). The returned order contains n + 1 endpoints.

Where it is used

This pattern is useful when unordered directed links must be rebuilt into one chain. Examples include reconstructing travel legs, restoring workflow steps, connecting predecessor-successor records, or ordering events when each valid source points to one unique next item.

Why Interviewers Ask This

This problem tests whether a candidate can turn unordered relationship records into one structured sequence. It checks recognition of the hash-map and hash-set pattern, identification of a unique starting state, and maintenance of invariants while following links. It also tests validation of malformed structures such as duplicate sources, cycles, and disconnected records. In C#, it evaluates correct use of Dictionary, HashSet, TryAdd, TryGetValue, and accurate expected-time complexity analysis.

Common interview mistakes

A common mistake is trying to sort the records instead of following their directed relationships. Another is building the source-to-destination dictionary but not collecting destinations, which makes the unique start difficult to identify. Candidates may also overwrite a duplicate source instead of rejecting the ambiguous successor. Another mistake is stopping when an endpoint has no successor without checking whether every record was consumed. Finally, it is incorrect to describe Dictionary and HashSet operations as guaranteed O(1); their lookup and insertion operations are O(1) on average.

Interview tip

State the invariant before writing code: the start is the unique source that never appears as a destination, and every valid source has at most one successor. Then trace SFO → LAX → DEN → SEA → BOS while writing the dictionary traversal.

Interviewer may ask next
What changes if the input records can be disconnected instead of forming one complete chain?

The same dictionary and destination-set construction can still be used, but there may be several sources that never appear as destinations. I would start one traversal from each such source and track which records have been consumed. The output becomes a collection of chains instead of one sequence. Any remaining unvisited records can indicate a cycle. Expected time remains O(n), and auxiliary space remains O(n). The main tradeoff is more validation and a more complex output.

What changes if the ticket records arrive as a stream and cannot be read a second time?

I can build nextByFrom and the destination set during the single pass over the stream. After the stream ends, I find the unique source missing from the destination set and follow the stored dictionary links exactly as before. The same invariants are preserved. Expected time is O(n), and auxiliary space is O(n). The main tradeoff is that reconstruction normally cannot finish until the stream ends because the unique start and the complete set of records are not known earlier.

13. Twenty VariantsCodingHardMeta

Question Details

Count or compare the 20 variants implied by the prompt and explain how you avoid double-counting equivalent cases.

Short Interview Answer (30-60 seconds)

I would treat the 20 supplied variants as raw cases and convert each one to a canonical key based on the equivalence rule from the problem. I store those keys in a HashSet. If two variants are equivalent, they produce the same key, so the set counts that equivalence class only once. I process all variants once. In general, the expected time is O(n · C), where C is canonicalization and hashing cost, and the auxiliary space is O(u · S).

Detailed Explanation

See the Code while reading this explanation.

The problem gives exactly 20 candidate variants. Some variants may represent the same logical case. We need to count or compare the distinct cases without counting equivalent variants more than once. The main idea is to convert each variant into one standard representation, called a canonical key. Equivalent variants must produce the same key. We then keep the unique keys in a set. The diagram does not define the actual contents of all 20 variants, so it correctly does not give one final numeric distinct count.

Useful Questions to Ask the Interviewer
  1. What exact rule decides whether two variants are equivalent?
  2. What canonical representation should we use for each equivalence class?
  3. Do you want only the number of distinct classes, or also the variants inside each class?
Twenty Variants diagram
How to Explain It in an Interview
1. Understand the input and required output

The input is exactly 20 supplied variants. The diagram labels them symbolically as V1 through V20 because their real contents are not specified. The output is the number of distinct equivalence classes. This is also the number of unique canonical keys. We must use the equivalence rule defined by the problem. We must not invent a rule such as ignoring order unless the problem explicitly says that order does not matter.

2. Choose the algorithm and data structure

For each raw variant, we compute one canonical key. A canonical key is the standard representation of that variant's equivalence class. Equivalent variants must produce the same key. The C# solution stores those keys in a HashSet<string>. A hash set keeps only one copy of an equal key, so it naturally prevents double-counting.

3. Process the variants

We visit each of the 20 variants once. For each variant, we call the supplied canonicalization function. We then add the returned key to the hash set. If the key is new, one new equivalence class has been discovered. If the key already exists, HashSet.Add leaves the set unchanged, so that equivalent raw variant is not counted again.

4. Walk through the symbolic example

The diagram shows V1 mapping to K1. K1 has not been seen, so the distinct-key count becomes 1. V2 maps to K2. K2 is new, so the count becomes 2. V3 maps to K1. K1 already exists, so the count stays 2. The middle variants are intentionally omitted from the symbolic trace. V20 is shown mapping to K7, but the diagram marks whether that key was already seen as unknown because the omitted mappings are not specified. Therefore, the final result remains the number of unique canonical keys rather than an invented numeric value.

5. Explain why the result is correct

The invariant is that after processing any prefix of the input, the HashSet contains exactly one canonical key for each distinct equivalence class seen so far. If two raw variants are equivalent, a correct canonicalization function gives them the same key. The set therefore stores that class only once. If two variants are not equivalent, a correct canonicalization function gives them different keys. After all 20 variants are processed, the set count is exactly the number of distinct equivalence classes.

6. Explain the C# implementation

The method receives the 20 variants and a canonicalize function. It checks both arguments for null and verifies that exactly 20 variants were supplied. It creates an empty HashSet<string>. It processes each variant, computes its canonical key, and adds that key to the set. Duplicate keys do not create additional entries. The method finally returns uniqueKeys.Count. The Main method prints the exact symbolic trace shown by the diagram without inventing the mappings that the diagram intentionally leaves unspecified.

7. Explain complexity and edge cases

Let n be the number of variants. The diagram uses n = 20. Let C be the cost of canonicalizing and hashing one variant. We process each variant once, so the expected time is O(n · C). HashSet lookup and insertion are O(1) on average after a key is produced. If u unique keys are stored and their average size is S, auxiliary space is O(u · S). If all 20 variants are equivalent, the result is 1. If all 20 are non-equivalent, the result is 20. Mixed duplicates are counted once per canonical key.

Key Insight / Why This Solution Works

The key insight is to count equivalence classes instead of raw variants. Each raw variant is converted to a canonical key using the equivalence rule defined by the problem. The central invariant is: after processing any prefix of the input, the HashSet contains exactly one canonical key for every distinct equivalence class seen in that prefix. Equivalent variants map to the same key, so they cannot increase the distinct count more than once. Non-equivalent variants must map to different keys. This makes a hash set a direct fit for removing equivalent duplicates.

Code
using System;
using System.Collections.Generic;

public static class Program
{
    public static int CountDistinctVariants(IReadOnlyList<string> variants,
                                            Func<string, string> canonicalize)
    {
        // The algorithm needs a real collection of supplied variants.
        if (variants is null)
            throw new ArgumentNullException(nameof(variants));

        // The equivalence rule is represented by the canonicalization function.
        // It decides which raw variants should receive the same canonical key.
        if (canonicalize is null)
            throw new ArgumentNullException(nameof(canonicalize));

        // The interview question and approved diagram both require exactly 20 variants.
        if (variants.Count != 20)
            throw new ArgumentException("Exactly 20 variants are required.", nameof(variants));

        // Each stored key represents one distinct equivalence class seen so far.
        HashSet<string> uniqueKeys = new();

        // Process each supplied variant exactly once.
        foreach (string variant in variants)
        {
            // Convert this raw variant into the standard key defined by the problem.
            string key = canonicalize(variant);

            // A duplicate key is already represented in the set.
            // HashSet.Add leaves the set unchanged when the same key is added again.
            uniqueKeys.Add(key);
        }

        // One unique key corresponds to one distinct equivalence class.
        return uniqueKeys.Count;
    }

    public static void Main()
    {
        // Build the same symbolic set of 20 supplied variants used by the diagram.
        List<string> variants = new();
        for (int i = 1; i <= 20; i++)
        {
            variants.Add($"V{i}");
        }

        // The approved diagram intentionally provides only these representative mappings.
        // We print those exact mappings instead of inventing keys for the omitted variants.
        Console.WriteLine("V1 -> K1");
        Console.WriteLine("V2 -> K2");
        Console.WriteLine("V3 -> K1");
        Console.WriteLine("...");
        Console.WriteLine("V20 -> K7");

        // V1 and V3 share K1, demonstrating how equivalent cases are counted once.
        Console.WriteLine("V1 and V3 belong to the same equivalence class.");

        // Because the middle canonical mappings are unspecified, no numeric final count is
        // invented.
        Console.WriteLine(
            "Result = number of unique canonical keys among the 20 supplied variants.");
    }
}
Time & Space Complexity

Let n be the number of variants. The diagram uses exactly 20. Let C be the cost of canonicalizing and hashing one variant. We process every variant once, so the expected time is O(n · C). HashSet lookup and insertion are O(1) on average after the key is produced. Let u be the number of unique canonical keys and S be the average stored key size. The auxiliary space is O(u · S). This is expected-time wording because C# hash-based collection operations are average O(1), not guaranteed worst-case O(1).

Where it is used

This pattern is useful when different raw inputs can represent the same logical item. Examples include deduplicating normalized records, grouping equivalent configuration states, removing repeated normalized requests, and counting unique generated test cases. The important requirement is that the canonicalization rule must exactly match what the application considers equivalent.

Why Interviewers Ask This

This question checks whether you recognize that the real task is deduplicating equivalence classes rather than simply counting 20 inputs. The interviewer is testing whether you can define a stable canonical representation, choose a suitable hash-based data structure, reason correctly about duplicates, and avoid inventing assumptions that the prompt does not provide. It also checks whether you can explain the invariant, relevant edge cases, and expected hash-set complexity accurately in C#.

Common interview mistakes

A common mistake is inventing an equivalence rule, such as saying order does not matter, when the problem has not defined that rule. Another mistake is counting all 20 raw variants instead of counting unique canonical keys. A candidate can also write a bad canonicalization function that gives different keys to equivalent variants or the same key to non-equivalent variants. Another mistake is inventing a final numeric answer even though the diagram does not define the omitted mappings. Finally, do not claim that HashSet operations are guaranteed O(1); they are O(1) on average.

Interview tip

State the invariant early: one canonical key represents one equivalence class. Then use the exact V1 → K1, V2 → K2, V3 → K1 trace to show why the distinct count does not increase when an equivalent variant appears again.

Interviewer may ask next
What changes if I also need to know which raw variants belong to each equivalence class?

Use a Dictionary<string, List<string>> instead of only a HashSet<string>. The canonical key is the dictionary key. For each raw variant, compute its key and append the variant to that key's list. Equivalent variants still go into the same class, so correctness is preserved. The expected processing time remains O(n · C), plus the cost of storing each raw variant. Space increases because we now keep both the unique keys and every group member. The tradeoff is extra memory in exchange for retaining class membership.

What happens if the canonicalization function does not exactly match the equivalence rule?

The result can be wrong even when the HashSet code is correct. If two equivalent variants receive different keys, the algorithm over-counts them. If two non-equivalent variants receive the same key, the algorithm under-counts them. Correctness therefore depends on the canonicalization function having both properties shown in the diagram: equivalent cases must map to the same key, and non-equivalent cases must map to different keys. The expected processing complexity stays the same, but the returned count is trustworthy only when that mapping is correct.

14. Design apis for facebook feed.API DesignEasyMeta

Question Details

Use the reported Meta Senior Engineering Manager prompt and specify the feed-facing endpoints, read/write actions, and client-facing response shape.

Short Interview Answer (30-60 seconds)

At a high level, I would design the Facebook feed API around reading the feed, creating posts, and interacting with feed items. Clients send HTTPS requests with a JWT to an ASP.NET Core API Gateway. The gateway validates the token, rate limits traffic, routes the request, and returns the JSON response. The Feed Service handles the feed endpoints, uses the shown data stores and Redis cache, and publishes Kafka events for background work. The trade-off is more infrastructure and operational complexity in exchange for better scaling, security, caching, and asynchronous processing.

Detailed Explanation

This question asks us to design how Facebook clients use the feed. A user should be able to open the feed, load more items, refresh it, create a post, like or comment on a post, share it, and manage feed choices. The client also needs a clear response containing the feed items and information for loading the next page. The main challenge is keeping these actions fast, safe, and easy to scale. I would explain the design in the same order as the diagram, from the client to the gateway, Feed Service, storage, and background workers.

Useful Questions to Ask the Interviewer
  • Do we need both feed reads and post interactions?
  • Should the feed support incremental loading and explicit refresh?
  • Do we need preferences, seen state, and reporting?
  • Should fanout, notifications, search, and analytics be asynchronous?
Design apis for facebook feed. diagram
How to Explain It in an Interview
1. Start with clients and identity

I would start with the clients. The diagram supports iOS, Android, web, and other clients. The Auth Service handles login or signup, token issuance, and user profile information. After authentication, it returns a JWT to the client. A JWT is a signed token that represents the authenticated user.

For a feed request, the client sends an HTTPS request with that JWT to the API Gateway. HTTPS protects the request while it travels over the network. The security section requires HTTPS everywhere using TLS 1.2 or later.

2. Send every feed request through the API Gateway

The API Gateway is an ASP.NET Core component. It validates the JWT, applies rate limiting, performs request routing, shapes responses, uses Redis caching, and records logging and metrics. Rate limiting protects the API from excessive traffic.

The request moves from the client to the gateway. The gateway forwards it to the Feed Service. The Feed Service returns its service response to the gateway. The gateway then sends an HTTPS JSON response back to the client.

3. Define the feed read APIs

The main read endpoint is GET /feed, which gets the news feed. GET /feed/{feedId} gets a single feed. The diagram uses GET /feed?since_id=123 for pagination. GET /feed/refresh refreshes the feed. GET /feed/preferences gets the user's feed preferences.

The client-facing GET /feed response contains status, data, and paging. Inside data.feed, each item contains post_id, an actor with id, name, and profile_picture, content, media, stats, privacy, created_at, and actions. The stats object contains values such as like_count, comment_count, and share_count. The actions object tells the client whether the viewer can like, comment, or share. The paging object contains next and has_more for the next page.

4. Define write and interaction APIs

For writes, POST /feed creates a post. POST /feed/{postId}/like likes a post. POST /feed/{postId}/comment adds a comment. POST /feed/{postId}/share shares a post. DELETE /feed/{postId} deletes a post. POST /feed/preferences updates preferences.

The diagram also shows POST /feed/seen to mark items as seen and POST /feed/report to report content. These requests follow the same client-to-gateway-to-Feed-Service path.

5. Use the shown stores for feed data

The Feed Service reads and writes the Data Stores boundary. The Feed Store uses Cassandra or ScyllaDB for feed items and metadata. The User Graph Store uses Neo4j or JanusGraph for follow relationships, blocks, and mutes. The Media Store uses blob or object storage for images, videos, and thumbnails. Redis is used for feed caching and counters.

The diagram shows data returning from the stores to the Feed Service. The Feed Service then builds the service response and sends it back through the gateway.

6. Move background work through Kafka

The Feed Service also sends events to the Kafka Event Pipeline. The visible events are PostCreated, PostLiked, CommentAdded, PostShared, and PostDeleted.

Consumers and Workers process those events for feed fanout to followers, notifications, search indexing, and analytics or machine learning. This is asynchronous work, so it stays outside the direct client response path. That keeps the synchronous feed request focused on returning the API result.

7. Explain errors, security, and the trade-off

The diagram defines common errors. 400 means invalid parameters. 401 means the token is missing or invalid. 403 means the requested action is not allowed. 404 means the resource was not found. 429 means the caller was rate limited. 500 means an internal server error, with the guidance to try again later.

Security and governance also include JWT authentication using OAuth 2, privacy filters for personally identifiable information, rate limiting and abuse protection, input validation and sanitization, plus audit logs and monitoring.

The benefit is a clear API boundary with caching and asynchronous processing. The downside is additional operational complexity because the design includes a gateway, several data stores, Redis, Kafka, and background workers.

Practical Complexity & Trade-offs

The main design choice is to keep client calls simple while placing shared work behind the API Gateway and Feed Service. The gateway gives one place for JWT validation, rate limiting, routing, response shaping, caching, logging, and metrics. Redis can make feed access faster, but cached data can add freshness concerns. Kafka moves fanout, notifications, search indexing, and analytics outside the direct response path. The benefit is that these background jobs do not need to finish before every client response. Different stores also handle different kinds of data, including feed items, relationships, media, and cached counters. The downside is more infrastructure to deploy, operate, and monitor. We accept this complexity because a large feed needs strong scaling, security controls, caching, and separation between synchronous requests and asynchronous work.

Why Interviewers Ask This

Interviewers ask this question to see whether a candidate can turn a familiar product feature into clear API contracts. They look for sensible HTTP methods, feed actions, pagination, a useful client response shape, and correct request and response flow. They also evaluate authentication, rate limiting, caching, storage choices, asynchronous events, error handling, scalability, and security ownership. The important skill is not memorizing endpoints. It is explaining why each part exists and what trade-off the design makes.

Interviewer may ask next
How would this design handle a very large increase in feed traffic?

I would keep the existing API contracts and scale the components already shown in the diagram. GET /feed would still enter through the API Gateway and then reach the Feed Service. Redis caching becomes more important because cached feed data can reduce repeated reads from the underlying stores. The Feed Store remains Cassandra or ScyllaDB, while the other shown stores continue handling graph, media, and cached data according to their existing roles.

For writes and interactions, the Feed Service would continue sending the shown events through Kafka. Feed fanout, notifications, search indexing, and analytics would remain in Consumers and Workers instead of becoming part of the synchronous client response. That separation lets background work progress independently from the direct request path.

The same security controls remain in place, including JWT validation, rate limiting, input validation, privacy filters, and monitoring. The main downside is operational complexity because greater traffic requires more capacity across the gateway, service, stores, Redis, Kafka, and workers.

How would you protect the feed API from abusive or unauthorized requests?

I would use the security controls already shown in the design. The Auth Service handles login or signup and token issuance, then returns a JWT to the client. The client sends that JWT with its HTTPS feed request to the API Gateway. The gateway validates the JWT before routing the request to the Feed Service. A missing or invalid token maps to 401, while an action that is not allowed maps to 403.

The gateway also applies rate limiting. When the caller exceeds the allowed rate, the API can return the shown 429 response. The Security and Governance section also includes rate limiting and abuse protection, input validation and sanitization, privacy filters for personally identifiable information, audit logs, monitoring, and HTTPS everywhere with TLS 1.2 or later.

These protections apply without changing the existing feed endpoint design. The downside is additional validation and operational work on every request, but those controls reduce unauthorized access, abusive traffic, and unsafe input.

15. Design an API for user access controlAPI DesignEasyMeta

Question Details

Use the Meta Enterprise Engineer prompt and cover roles, permissions, and how callers are authenticated or authorized.

Short Interview Answer (30-60 seconds)

At a high level, I would build one access-control API for users, roles, permissions, assignments, and authorization checks. Callers send HTTPS requests through an ASP.NET Core API Gateway with a JWT. The gateway validates the token, checks policies or scopes, and forwards the caller context to the ASP.NET Core Access Control Service. That service evaluates roles and permissions using the relational database and may cache policy data in Redis. Responses return through the gateway. The main trade-off is stronger centralized security and auditing versus extra gateway, cache, and operational complexity.

Detailed Explanation

This question asks us to design a service that controls who can do what. We need to manage users and define groups of allowed actions. We also need to connect users to those groups and check access when a caller asks to use something. The caller must first prove its identity. Then the system decides whether that caller has permission for the requested action. The diagram uses a gateway, an access-control service, stored access data, caching, logging, and security support to solve this problem.

Useful Questions to Ask the Interviewer
  • Are the callers people, internal services, or both?
  • How often can roles, permissions, and assignments change?
  • How quickly must an authorization decision return?
Design an API for user access control diagram
How to Explain It in an Interview
1. Define the access-control resources and endpoints

I would separate access control into users, roles, permissions, assignments, and authorization checks. The ASP.NET Core Access Control Service owns these business operations.

For users, the diagram shows GET /api/users, POST /api/users, and GET, PUT, or DELETE /api/users/{id}. Roles use GET /api/roles, POST /api/roles, and GET, PUT, or DELETE /api/roles/{id}. It also shows POST /api/roles/{id}/users for assigning users to a role.

Permissions use GET /api/permissions, POST /api/permissions, and GET, PUT, or DELETE /api/permissions/{id}. Assignments use GET /api/assignments, POST /api/assignments, and DELETE /api/assignments/{id}.

2. Authenticate and filter requests at the API Gateway

The request first reaches the ASP.NET Core API Gateway over HTTPS. The request carries a JWT, which is a signed token containing caller information such as sub, roles, and scopes.

The gateway performs JWT validation. The diagram shows the gateway validating the token with the external Identity Provider through JWKS or introspection and receiving a token-validation response. JWKS means public signing keys that can be used to verify a token. The gateway also handles routing, rate limiting, policy or scope authorization, request and response logging, and correlation or tracing.

Authentication and authorization are different. Authentication checks who the caller is. Authorization checks what that authenticated caller may do.

3. Forward the validated caller context to the service

After the gateway accepts the request, it forwards the valid request to the Access Control Service. The diagram shows the forwarded context containing the user context, roles, and scopes.

The service contains a Users & Roles API, Permissions API, and Authorization API. The Authorization API checks access using a user, resource, and action. It also enforces policies and evaluates role or permission claims.

For a direct decision, the diagram shows POST /api/authorize/check. Its body contains userId, resource, and action. The diagram also shows GET /api/authorize/policies for authorization policies.

4. Store and retrieve users, roles, permissions, and assignments

The Access Control Service reads and writes access-control data in the relational database. The database stores users, roles, permissions, and assignments. The diagram shows ADO.NET or Entity Framework Core for the service-to-database access.

The service can also get or set cached policies and permissions in Redis. The service receives the cache result back from Redis. This can reduce repeated database work for authorization decisions.

The relational database remains the main stored data source shown in the diagram. Redis is an optimization for cached policies and permissions.

5. Return the response through the gateway

After the Access Control Service finishes the operation, it sends the service response back to the API Gateway. The gateway then returns the HTTPS response to the original caller.

The diagram explicitly shows examples such as 200, 403, and 404 on this response path. A 200 indicates a successful operation. A 403 means the caller is authenticated but is not allowed to perform the requested action. A 404 means the requested resource was not found.

The important point is that the response travels back in the reverse service path: Access Control Service to API Gateway, then API Gateway to the caller.

6. Support auditing, monitoring, secrets, and optional events

The design also includes supporting components outside the main synchronous response path. Audit & Logging records the audit trail, security events, and access decisions. The diagram names Serilog or Seq for this area.

Monitoring & Tracing uses OpenTelemetry for metrics, distributed tracing, and alerts. Secrets Management stores signing keys, database credentials, and API secrets.

The Message Broker is optional. The diagram names RabbitMQ or Azure Service Bus. It can carry user or role change events, support cache invalidation, and support asynchronous audit processing. This broker does not replace the normal request and response path.

The diagram also exposes GET /health, GET /version, and GET /open-api.json. The stated security principles are least privilege, deny by default, secure by design, auditing, and encryption in transit and at rest.

Practical Complexity & Trade-offs

The benefit of this design is clear responsibility. The API Gateway handles routing, rate limiting, JWT validation, early policy or scope checks, logging, and tracing. The Access Control Service owns users, roles, permissions, assignments, and access decisions. Redis can make repeated policy or permission checks faster and reduce database work. The downside is cache correctness. A changed role or permission can make old cached data incorrect. The optional message broker can help with change events and cache invalidation, but it adds another system to operate. Central logging and tracing improve security and support, but they also add storage and operational work. We accept these costs because access control needs clear ownership, consistent checks, and a useful audit trail.

Why Interviewers Ask This

Interviewers ask this question to test whether you can model users, roles, permissions, and assignments clearly. They want to see that you separate authentication from authorization and understand where each check happens. They also evaluate request and response flow, HTTP endpoint design, data ownership, caching, rate limiting, auditing, and security judgment. A strong answer explains these choices simply and discusses the performance and operational trade-offs without making the design unnecessarily complex.

Interviewer may ask next
What would you change if authorization traffic became very high?

I would keep the same request path and use the Redis cache shown in the diagram more effectively. The main affected operation is POST /api/authorize/check. The caller would still send the request through the API Gateway. The gateway would still validate the JWT, check policies or scopes, and forward the caller context to the Access Control Service.

The service could read frequently used policies or permissions from Redis instead of querying the relational database every time. The database would still store the users, roles, permissions, and assignments shown in the design.

When roles or permissions change, related cached data must be invalidated or refreshed. The optional Message Broker shown in the diagram can carry user or role change events and support cache invalidation. OpenTelemetry can continue measuring latency and service behavior.

The benefit is lower database load and faster repeated checks. The downside is stale-cache risk. Because authorization is security-sensitive, I would keep the deny-by-default principle and avoid treating uncertain cached data as permission to access a resource.

How would you handle a role or permission change safely?

I would make the change through the existing Access Control Service and keep the same security boundaries. Role changes use the role operations shown in the diagram. Permission changes use the permission operations. Assignment changes use POST /api/assignments or DELETE /api/assignments/{id}.

The service writes the updated users, roles, permissions, or assignments to the relational database. Any cached policy or permission affected by that change should then be refreshed or invalidated. The optional Message Broker can carry user or role change events and support that cache invalidation flow.

Audit & Logging should record the change and related security activity. Monitoring & Tracing continues through OpenTelemetry. The gateway still validates incoming JWTs and performs its policy or scope checks. The Authorization API still checks access and evaluates role or permission claims.

The main downside is coordination between stored data and cached data. Caching improves performance, but an old permission can produce the wrong decision. That is why cache invalidation is an important part of this design.

16. Design Dropbox (file storing and sharing)API DesignMediumMeta

Question Details

Keep the design at the Dropbox file-storage boundary reported by Meta, covering file objects, sharing semantics, and sync-oriented API calls.

Short Interview Answer (30-60 seconds)

At a high level, I would design Dropbox around file storage, sharing, and efficient synchronization. Clients send HTTPS requests with a JWT through an API Gateway. The gateway handles TLS termination, rate limiting, authentication, authorization, routing, and request or response logging. Core services manage files, shares, users, uploads, metadata, and sync. File content goes to immutable blob storage, while metadata stays in SQL. Domain events drive background work such as scanning, indexing, previews, retention, quotas, and notifications. The trade-off is greater operational complexity for better scaling, strong metadata consistency, and clear service ownership.

Detailed Explanation

This question asks us to design how people store files, share them, and keep several devices updated. We need to show where file content lives, where information about each file is stored, and how sharing permissions work. We also need a practical way to upload large files and send only new changes during synchronization. The design should protect requests, support many clients, and move slow work away from the main request. I will follow the diagram from the clients through the gateway, core services, storage, and background processing.

Useful Questions to Ask the Interviewer
  • Should we support both personal files and shared files?
  • How large can files become, and should large uploads be resumable?
  • How quickly should changes appear on another device?
  • Do we need versions, trash and restore, and shared links?
Design Dropbox (file storing and sharing) diagram
How to Explain It in an Interview
1. Start with clients, identity, and the API Gateway

I would start with the client boundary. The diagram supports a Web App, Mobile App, Desktop Client, and CLI or Third Party Integrations. Clients use the Identity Provider for login and consent. The Identity Provider uses OAuth 2.0 or OpenID Connect and owns authentication, authorization, and token issuance. API requests then reach the API Gateway over HTTPS with a JWT. The gateway terminates TLS, validates authentication and authorization information, applies rate limiting, routes requests, and records request and response logs. The client response returns through the gateway as HTTPS JSON.

2. Route requests to the Dropbox Core Services

The gateway sends requests to Dropbox Core Services using gRPC or HTTPS with mTLS. Here, mTLS means the connection is encrypted and both sides can authenticate each other. The File Service manages files, folders, metadata, versioning, trash, and restore. The Sharing Service manages shares, links, permissions, and access control. The Sync Service owns delta sync, cursors, change tracking, and conflict resolution. The User Service manages profiles, quotas, preferences, and devices. The Upload Service creates upload sessions, manages chunks, and commits or finalizes uploads. The Metadata Service manages file metadata, versions, checksums, and retention. Service responses return toward the gateway as Protobuf or JSON.

3. Separate file blobs from metadata

I would store large file content separately from metadata. Dropbox Core Services upload and download file content over HTTPS to Object Storage. The Blob Store may use S3, GCS, or Azure Blob and stores files as immutable blobs. Blob responses return to the core services. Metadata uses the Metadata Store, shown as a SQL Database with a primary and read replicas. It stores users, files, folders, shares, permissions, versions, devices, and sync state. Core services read and write this data through ADO.NET, and query results return to the services. This separation lets large file data scale differently from strongly consistent metadata.

4. Use the sync-oriented API calls shown in the diagram

For a large upload, POST /2/files/upload_session/start creates an upload session and returns session_id. POST /2/files/upload_session/append_v2 uploads a chunk and returns cursor. POST /2/files/upload_session/finish commits the file and returns file metadata. POST /2/files/download downloads file content and returns file bytes. POST /2/files/list_folder lists folder contents and returns entries. POST /2/files/list_folder/continue performs delta sync and returns entries plus a cursor. POST /2/sharing/create_shared_link creates a shared link and returns link metadata. The cursor lets a client continue from an earlier synchronization point instead of repeatedly requesting the full folder state.

5. Move slow work to the Event Bus and Background Workers

Core services publish domain events asynchronously to the Event Bus, shown as Kafka or Pulsar. These events are separate from the synchronous client response path. Background Workers consume them. The Thumbnail Generator creates previews. The Virus Scanner scans uploaded files. The Indexing Worker extracts text and metadata. Retention and Lifecycle applies retention and cleanup. Quota Enforcer monitors usage and quotas. Index data is sent asynchronously to Search / Indexing, where Elasticsearch provides full-text search over files and metadata. Notifications are also published asynchronously for email, push, and in-app messages.

6. Finish with reliability, security, and trade-offs

The diagram keeps metadata strongly consistent and uses high availability through multi-AZ deployment. File blobs are immutable, while version information is kept in metadata. It also calls for idempotent APIs for safe retries, fine-grained sharing and permissions, encryption in transit with TLS and at rest, and efficient delta-plus-cursor synchronization. The API Gateway owns JWT validation, authorization, rate limiting, and logging before routing requests. The diagram does not define specific HTTP failure codes, so I would not invent them. The main trade-off is complexity. Multiple services, an event bus, SQL metadata, blob storage, workers, indexing, and notifications require more operations work, but they let storage, sync, sharing, and background processing scale independently.

Practical Complexity & Trade-offs

The main design choice is separating file bytes from metadata. Blob storage works well for large immutable files. SQL works well for users, folders, permissions, versions, devices, and sync state. Strong metadata consistency makes sharing and synchronization easier to reason about, but it needs more coordination. Upload sessions split large files into chunks. Delta sync with cursors avoids repeatedly sending the full folder state. The API Gateway centralizes TLS termination, JWT validation, authorization, rate limiting, routing, and logging. An Event Bus moves slow work to background workers. The benefit is clearer ownership and independent scaling. The downside is more services, events, storage systems, and operational work. We accept that complexity because file storage, sync, search, and background processing have different scaling needs.

Why Interviewers Ask This

Interviewers use this question to test whether you can define a clean boundary around file storage, sharing, and synchronization. They want correct request and response modeling, sensible ownership, and a clear separation between file content and metadata. They also look for judgment around authentication, authorization, rate limiting, consistency, large-file uploads, and asynchronous work. A strong answer explains realistic scaling and reliability choices while clearly describing the costs and trade-offs instead of only listing components.

Interviewer may ask next
How would this design handle much larger files and unreliable client connections?

I would keep the same architecture and use the existing upload-session flow more heavily. The client begins with POST /2/files/upload_session/start and receives session_id. It then sends file chunks with POST /2/files/upload_session/append_v2, which returns cursor information. When all chunks are ready, POST /2/files/upload_session/finish commits the upload and returns file metadata. The Upload Service continues to own upload sessions, chunk management, and finalization. File content still goes to immutable Object Storage, while the Metadata Store keeps file and version information. The API Gateway still handles HTTPS, JWT validation, authorization, rate limiting, routing, and logging. The diagram also calls for idempotent APIs for safe retries. Chunked sessions reduce the amount of work that must be repeated after a connection problem. The downside is extra state and coordination around sessions, chunks, cursors, and final commit. That complexity is worthwhile when files are large or client networks are unreliable.

How would you keep many devices synchronized without sending the whole folder state every time?

I would use the existing delta-sync design with cursors. A client can first call POST /2/files/list_folder to receive folder entries. After that, it calls POST /2/files/list_folder/continue and uses the synchronization cursor so the response contains only later entries plus a new cursor. The Sync Service remains responsible for delta sync, cursors, change tracking, and conflict resolution. The Metadata Store keeps the file, device, version, and sync-state information needed by that flow. Core services also publish domain events asynchronously to the Event Bus. Background workers can then update Search / Indexing and publish Notifications without making that work part of the synchronous client response. The API Gateway continues to enforce JWT validation, authorization, rate limiting, routing, and logging. Fine-grained sharing permissions remain unchanged. The downside is additional cursor state and conflict-handling complexity. The benefit is much lower repeated data transfer and less work for both clients and services.

17. Design a Game Leaderboard, showing top scores and rankings. And quickly retrieving score and rank of each playerAPI DesignHardMeta

Question Details

Use the Meta Infrastructure Engineer prompt and explain the leaderboard API, ranking reads, and the fast lookup path for individual player scores.

Short Interview Answer (30-60 seconds)

At a high level, I would keep leaderboard reads on a fast Redis path and keep durable scores in Cassandra or MongoDB. The client sends an HTTPS request with a JWT through the API Gateway to the ASP.NET Core leaderboard service. Top-N reads use a Redis sorted set, while a player lookup uses a Redis hash for fast score and rank access. Score updates change Redis and are persisted asynchronously by background workers. The main trade-off is speed versus temporary delay between Redis, rank maintenance, and durable storage.

Detailed Explanation

This problem is about showing the best game scores very quickly. It must also find one player’s score and rank without scanning every player. A player can request the top list, request their own result, or submit a new score. The design keeps common reads in Redis because Redis is fast. It keeps durable score data in Cassandra or MongoDB. It also checks the caller before routing requests to the leaderboard service. I will follow the diagram’s gateway, API, Redis, background worker, storage, and monitoring paths.

Useful Questions to Ask the Interviewer
  • Is each leaderboard separated by game, as shown by the gameId Redis keys?
  • How fresh must a player’s rank be after scores change?
  • Should score updates replace a score or increment it?
Design a Game Leaderboard, showing top scores and rankings. And quickly retrieving score and rank of each player diagram
How to Explain It in an Interview
1. Start with the three leaderboard operations

I would start with the three operations shown in the diagram. GET /leaderboard/top?limit=100 returns the top N players. GET /leaderboard/player/{playerId} returns one player’s rank and score. POST /leaderboard/score submits or updates a score with playerId, score, and metadata. These operations cover the main read and write needs of the leaderboard.

2. Route and protect the request

The game client sends an HTTPS request with a JWT to the API Gateway. The gateway handles rate limiting, authentication and authorization checks, routing, and request validation. The diagram also shows token validation through the Auth Service using JWKS or introspection. The Auth Service returns Token OK on the shown success path. The gateway then routes the request to the ASP.NET Core leaderboard service. The normal business response returns from the leaderboard service through the gateway to the client.

3. Read the top leaderboard from Redis

For the top leaderboard request, the service reads the Redis sorted set named leaderboard:{gameId}. The diagram shows the top-N read using ZRANGE. The sorted set keeps players ordered by score. Redis returns the requested top players to the leaderboard API. The service then returns that result through the gateway. This is the fast read path for showing the current leaders without querying the durable store for each request.

4. Use the Redis hash for one-player lookup

A player lookup uses the Redis hash player:{gameId}:{playerId}. The diagram shows this hash storing score, rank, and updatedAt. The service reads the rank and score with HGET. This gives a direct lookup for one player instead of scanning the complete leaderboard. The response returns the player’s score and rank through the leaderboard API and API Gateway to the game client.

5. Update scores and maintain ranking data

For POST /leaderboard/score, the leaderboard service updates the Redis ranking data using ZADD or ZINCRBY. It also updates the player data used by the fast lookup path. The diagram shows background workers handling bulk persistence, rank rebuilding when needed, and cleanup or TTL work. These workers help keep the hot leaderboard data useful while moving durable score information to Cassandra or MongoDB.

6. Persist data and operate the service safely

Cassandra or MongoDB is the durable score store in this design. Redis is the fast path for reads, while durable storage protects score data beyond the cache layer. The diagram also includes observability for logs, metrics, alerts, and tracing. These signals help detect slow reads, failed persistence, and worker problems. The APIs are stateless and can scale horizontally. The main trade-off is consistency timing. Fast Redis responses improve latency, but asynchronous persistence and rank rebuilding can temporarily lag behind the newest updates.

Time & Space Complexity

The benefit of this design is that common leaderboard reads stay fast. A Redis sorted set serves the top leaderboard, while a Redis hash gives direct access to one player’s score and rank. The diagram describes the player lookup as O(1). The API Gateway also protects the service with rate limiting, authentication, authorization, routing, and request validation. The downside is that Redis, background workers, and durable storage must stay coordinated. Asynchronous persistence improves the write path, but the durable store can briefly lag behind Redis. Rank rebuilding can also take time after many score changes. We accept this because leaderboard traffic needs very fast top-N and individual-player reads.

Why Interviewers Ask This

Interviewers ask this to test whether you can separate fast ranking reads from durable storage. They want clear API boundaries, correct request and response flow, sensible authentication, rate limiting, and good data structures. A strong answer explains why a sorted set and a player hash solve different lookup needs. It should also show judgment about asynchronous persistence, horizontal scaling, observability, and the consistency trade-off created by background rank maintenance.

Interviewer may ask next
How would this design handle a large spike in score updates?

I would keep the same API and data model, but scale the stateless ASP.NET Core leaderboard service and background workers horizontally. The affected write path is POST /leaderboard/score. The API Gateway still applies rate limiting, authentication, authorization, routing, and request validation before the request reaches the service. The service continues updating the Redis ranking with ZADD or ZINCRBY and updating the player lookup data. Background workers continue handling bulk persistence and rank maintenance. Cassandra or MongoDB remains the durable score store. Correctness is maintained by using the same game and player identifiers across the Redis and persistence paths. The main downside is temporary lag during a heavy burst. Durable storage or rebuilt rank data may briefly trail the newest Redis updates. The top-N endpoint, player lookup endpoint, security flow, and response path remain unchanged.

How would you recover if the Redis leaderboard data needed to be rebuilt?

I would use the durable scores in Cassandra or MongoDB as the recovery source and let the existing background workers rebuild the Redis data. The affected components are the persistent store, background workers, the Redis sorted set leaderboard:{gameId}, and the player hashes player:{gameId}:{playerId}. Rank rebuilding is already a responsibility of the background workers in the diagram, so recovery stays within the existing design. The workers can rebuild ranking information and refresh the Redis structures from durable score data. The API Gateway, JWT validation, ASP.NET Core API, and client-facing endpoints do not change. During rebuilding, leaderboard or player data may be temporarily stale until Redis is restored. The main downside is recovery time for a very large leaderboard. The benefit is that the durable store provides the source needed to reconstruct the fast Redis read paths.

18. How would you design a machine learning system to detect unsafe content?API DesignHardMeta

Question Details

Use the Meta interview guide prompt and treat the model-facing interfaces, moderation inputs, and safety constraints as the scope of the answer.

Short Interview Answer (30-60 seconds)

At a high level, I would put a moderation pipeline between submitted content and the final client response. Client Apps send text, images, or video through the API Gateway using HTTPS and JWT. The gateway checks identity, scopes, limits, and request shape. The Moderation Orchestrator Service loads safety policy, gets content features, calls the ML Inference Service, and creates the decision. Uncertain or high-risk cases use Human Review. The response returns as allow, block, or warn with a reason. The trade-off is stronger safety and auditability, but with more latency and operational complexity.

Detailed Explanation

This question asks how we can check user content before deciding whether it is safe. The content may be text, an image, or a video. The system should quickly return a useful decision such as allow, block, or warn. It should also keep enough information to explain and audit that decision. The difficult part is combining machine learning, written safety rules, and human judgment. I would explain the design by following the same path shown in the diagram, from the client request through moderation, review, storage, monitoring, and model improvement.

Useful Questions to Ask the Interviewer
  • Which content types are most important: text, images, or video?
  • Which unsafe categories and risk thresholds matter most?
  • What latency is acceptable for the moderation response?
  • When should an uncertain case require human review?
How would you design a machine learning system to detect unsafe content? diagram
How to Explain It in an Interview
1. Receive and protect the request

The request starts in Client Apps for web or mobile users. The client sends content through HTTPS with a JWT to the API Gateway. A JWT is a signed token that carries caller identity information. The gateway performs authentication, scope-based authorization, rate limiting, request validation, DDoS protection, and schema enforcement. If those checks succeed, it forwards the validated request to the Moderation Orchestrator Service.

2. Load the safety policy and prepare content features

The Moderation Orchestrator Service is the .NET and ASP.NET Core service coordinating the moderation flow. It asks the Policy & Rules Service for policies, taxonomies, risk thresholds, allow or block lists, and label definitions. Policy data returns to the orchestrator. The orchestrator also sends a feature request to the Feature Processing Service. That service produces text, image, and video features, embeddings, signals, and context. Those features return to the orchestrator for model evaluation.

3. Run ML inference and create the decision

The orchestrator sends an inference request to the ML Inference Service. That service contains text, image, video, multimodal, and risk-scoring models. It returns scores to the orchestrator. The orchestrator combines those scores with the safety rules and thresholds. It then generates the moderation decision and related reason information. This separation is important because a model score is only a signal. The written safety policy still helps determine the final action.

4. Use Human Review when the automated result is uncertain

The diagram includes a Human Review Platform for uncertain or high-risk cases. The moderation path can send those cases for review. Reviewers can inspect the content and metadata, use reviewer tools, create a decision and annotation, and use escalation workflows when necessary. The review result then returns to the moderation path. This adds a human safety layer for cases where automatic scoring is not enough.

5. Return the response to the client

The Moderation Orchestrator Service sends its decision response back to the API Gateway. The internal response carries the moderation action, reasons, and scores. The gateway then sends the HTTPS JSON API response back to Client Apps. The user-facing result is allow, block, or warn with a reason. Request and response remain separate flows, so the response travels back through the same gateway boundary instead of coming from logging or storage components.

6. Store decisions and observe the system

Decision and audit information is recorded across the supporting data and observability components. The Moderation Store keeps content metadata, decisions and scores, applied policies, review outcomes, and user actions. Content Storage keeps original content, thumbnails or frames, and derived artifacts. The Audit & Moderation Store keeps requests, responses, decisions, policy versions, reviewer actions, and system events as immutable logs. Metrics & Monitoring tracks latency, throughput, model performance, error rates, drift, and alerts. These systems support auditability and operations; they do not own the business response.

7. Improve models with a controlled training lifecycle

The Model Training Pipeline contains labeled-data ingestion, data validation and deduplication, model training, evaluation and fairness checks, and a versioned model registry. A trained, versioned model is then delivered to the ML Inference Service. The safety principles in the diagram emphasize defense in depth, privacy and data minimization, transparency, fairness, and continuous improvement. The benefit is safer and more explainable moderation. The downside is additional cost, latency, model governance, and operational work.

Practical Complexity & Trade-offs

The benefit of this design is clear separation of responsibilities. The API Gateway protects the entry point. The Moderation Orchestrator Service owns the moderation workflow. Policy, feature processing, inference, review, storage, monitoring, and training remain separate. This makes the system easier to audit and lets expensive parts scale independently. The downside is more network calls and more services to operate. Human review improves difficult decisions, but it costs money and can add delay. Keeping model versions, policy versions, reviewer decisions, and audit records also adds operational work. The system accepts this complexity because unsafe-content decisions need more than one protection layer. Machine learning gives fast signals, rules enforce safety policy, and human review handles difficult cases.

Why Interviewers Ask This

The interviewer is testing whether I can define clear API and service boundaries for a safety-sensitive system. They want correct request and response directions, proper ownership of authentication, authorization, policy evaluation, inference, review, storage, and logging. They also want to see whether I understand that model scores should not automatically become policy decisions. A strong answer balances safety, latency, scalability, auditability, model quality, and operational complexity while explaining the trade-offs clearly.

Interviewer may ask next
What would you change if moderation traffic increased by ten times?

I would keep the same architecture and scale the busiest services independently. The API Gateway would still handle HTTPS, JWT authentication, scope checks, rate limiting, validation, DDoS protection, and schema enforcement. The Moderation Orchestrator Service would still coordinate the moderation request and final response. I would increase capacity for Feature Processing and ML Inference because text, image, video, and multimodal processing can be expensive. Metrics & Monitoring would track latency, throughput, errors, and model performance so we could find the real bottleneck. Human Review should remain focused on uncertain or high-risk cases instead of receiving every request. The Moderation Store, Content Storage, and Audit & Moderation Store would continue recording the same information shown in the design. The main downside is operational complexity. More service instances make capacity planning, deployments, model-version consistency, and observability harder. I would accept that because the existing separation already allows each expensive part to scale without changing the moderation contract.

How would you improve model quality while keeping moderation decisions safe and explainable?

I would use the existing Model Training Pipeline and keep safety policy separate from the model. Labeled data enters the training pipeline, where it is validated and deduplicated before training. A candidate model then goes through evaluation and fairness checks and is stored in the versioned model registry. The trained, versioned model is delivered to the ML Inference Service. The Moderation Orchestrator Service still combines returned model scores with the Policy & Rules Service thresholds and safety rules before generating the final action. That means a new model does not silently replace written safety policy. The Audit & Moderation Store keeps policy versions, decisions, reviewer actions, and system events, while Metrics & Monitoring watches model performance and drift. This preserves traceability when behavior changes. The main downside is slower model iteration because validation, evaluation, versioning, fairness checks, and monitoring require extra work. I would accept that cost because unsafe-content detection needs controlled changes rather than unreviewed model updates.

19. What is API? Please explain in detail.API DesignEasyMeta

Question Details

Explain the API concept as it was asked in the Meta Solutions Architect report, focusing on interfaces, consumers, and the contract boundary.

Short Interview Answer (30-60 seconds)

At a high level, an API is a contract that lets one software system use another without knowing its internal implementation. In this design, mobile apps, web apps, partner integrations, and other services send HTTPS requests through a public API contract. The contract defines endpoints, HTTP methods, headers, schemas, errors, rate limits, and versioning. The API gateway then routes, validates, authenticates, authorizes, and monitors requests before internal services handle them. The trade-off is extra gateway and governance complexity in exchange for security, loose coupling, and a stable interface.

Detailed Explanation

This question asks what an API is and why software systems use one. In simple words, an API is an agreed way for one program to ask another program for something. The consumer only needs to know what it may ask for and what answer it will receive. It does not need to know how the provider works inside. The diagram shows this clear boundary between consumers and the provider. It also shows how requests enter, how shared security checks happen, how internal services do the work, and how responses return.

Useful Questions to Ask the Interviewer
  • Should I explain only the API concept, or also describe the gateway and security responsibilities shown in the design?
  • Should I focus on the public HTTP API model shown in the diagram?
What is API? Please explain in detail. diagram
How to Explain It in an Interview
1. Start with the API contract

I would start by saying that an API is a contract between a consumer and a provider. The consumer may be a mobile app, web app, partner integration, or another service. The provider publishes the interface and owns the implementation behind it. In this diagram, the public contract defines the base URL and endpoints, HTTP methods such as GET, POST, PUT, and DELETE, request headers such as authorization information, request and response schemas, the status-code and error model, rate limits, usage policies, versioning, and deprecation rules. Consumers depend on this contract instead of depending on the provider's internal code.

2. Send the request through the contract boundary

The request first moves from the consumer toward the provider over HTTPS. HTTPS uses TLS to protect the network connection. The request must follow the public contract, including the expected method, headers, and data format. The diagram shows JSON or XML schemas for requests and responses. The contract boundary defines what consumers may send and what behavior they can expect. This separation creates loose coupling. The provider can change its internal implementation while keeping the public contract stable for consumers.

3. Let the API gateway enforce shared rules

After the request passes through the public contract, it reaches the API gateway, which is the provider's entry point. The gateway handles routing and request validation. It also performs authentication and authorization. Authentication checks who the caller is, while authorization checks what that caller is allowed to do. The diagram shows JWT or OAuth 2 for authentication and RBAC or scopes for authorization. The gateway also applies rate limiting, request or response transformation, and logging and metrics. These common controls are applied before the request reaches the business services.

4. Route the request to the internal service

Once the request passes the gateway checks, the gateway routes it to the appropriate internal service. The diagram shows User Service, Order Service, Inventory Service, and Payment Service as examples of provider-owned implementation. These services contain business logic and operations. They remain hidden behind the public API contract. Internal services can use the database for persistent storage, the message broker for asynchronous events and messaging, and external services for third-party integrations. The message broker is a supporting asynchronous path and is not the normal synchronous response path to the consumer.

5. Return the response to the consumer

After the provider finishes the requested work, the response returns to the requesting consumer through the same public contract. The response follows the published response schema, such as JSON or XML. This gives the consumer a predictable result without exposing how the provider produced it internally. The diagram also defines a status-code and error model. If request validation, authentication, authorization, or rate-limit checks fail, the gateway rejects the request instead of allowing it to continue to the business services. The diagram does not specify individual numeric HTTP status codes, so I would not invent them.

6. Explain operations, evolution, and the trade-off

Finally, I would explain how the provider operates and evolves the API. Logging, metrics, tracing, alerts, monitoring, and analytics give visibility into API behavior. API documentation, shown as OpenAPI or Swagger, describes the developer contract. A developer portal helps consumers understand and use that contract. Versioning and deprecation rules let the provider evolve the API while giving consumers a controlled migration path. The benefit is a clear boundary, consistent security, and loose coupling. The downside is additional gateway, documentation, monitoring, and governance work. We accept that complexity because consumers get one stable and controlled interface.

Practical Complexity & Trade-offs

The main design choice is to keep a stable API contract in front of changing internal services. The benefit is that mobile apps, web apps, partners, and other services can depend on one clear interface. HTTPS protects traffic. Authentication checks who the caller is, while authorization checks what that caller may do. Request validation and rate limiting protect the provider from invalid or excessive traffic. Versioning and deprecation make changes safer for consumers. The API gateway centralizes these shared rules, which keeps business services focused on their own work. The downside is that the gateway and governance layer add operational effort. Documentation, logging, metrics, tracing, alerts, monitoring, and analytics also require maintenance. We accept this because the design gives better consistency, security, visibility, and loose coupling between consumers and the provider.

Why Interviewers Ask This

Interviewers ask this question to see whether a candidate understands an API as a contract, not just as a URL. They are checking whether you can separate consumers from the provider's implementation, model request and response flow correctly, and explain shared responsibilities such as validation, authentication, authorization, rate limiting, and versioning. They also want to see whether you understand ownership boundaries, loose coupling, and the operational trade-off of placing a managed gateway and governance layer in front of internal services.

Interviewer may ask next
What changes if traffic grows significantly and many more consumers start using this API?

I would keep the public API contract unchanged and increase capacity behind that contract. The affected flow is still the HTTPS request from consumers through the API contract and API gateway to the provider's internal services. The gateway keeps the same responsibilities: routing, request validation, authentication, authorization, rate limiting, transformation, logging, and metrics. The provider can add capacity to the gateway and to the internal services that receive more traffic. The database, message broker, and external-service integrations may also need more capacity when they become bottlenecks. Rate limiting remains important because it controls excessive usage from individual consumers. Logging, metrics, tracing, alerts, monitoring, and analytics help the provider find pressure points. The public methods, schemas, security rules, and versioning behavior stay the same. The downside is higher infrastructure and operational complexity. More capacity also means more components to monitor and manage, but consumers still depend on the same stable contract.

Why does this design put authentication, authorization, validation, and rate limiting at the API gateway?

The main reason is to apply common rules consistently before requests reach the internal business services. The affected component is the API gateway, which sits after the public contract and before User Service, Order Service, Inventory Service, and Payment Service. Authentication checks caller identity using the JWT or OAuth 2 approach shown in the diagram. Authorization then checks whether that caller has the required RBAC permission or scope. Request validation checks whether the request follows the published contract. Rate limiting controls excessive usage. Centralizing these checks gives mobile apps, web apps, partner integrations, and other services one consistent entry point. Logging and metrics at the gateway also improve visibility into accepted and rejected traffic. The downside is that the gateway becomes an important shared component that must be operated carefully. The public contract, internal business services, database, message broker, external services, and overall request-response model remain unchanged.

20. How do we respect privacy with the Facebook api?API DesignEasyMeta

Question Details

Discuss the Facebook API privacy question exactly as reported and cover the controls, data exposure limits, and permission boundaries mentioned by the prompt.

Short Interview Answer (30-60 seconds)

At a high level, I would protect privacy by asking for clear user consent and requesting only the Facebook data the application really needs. The user authorizes access through OAuth 2.0. The .NET application then sends an HTTPS request with a bearer token and least-privilege scopes to the Meta API Gateway. Meta validates the token, app status, permissions, rate limits, and policies, then returns only permitted data. I would also secure tokens, minimize stored data, honor deletion and revocation, and audit access. The trade-off is more operational work for much lower privacy risk.

Detailed Explanation

This question asks how an application can use Facebook information while respecting the person's privacy. The goal is simple. Ask before using data, collect only what is needed, protect it, and let the person stay in control. The difficult part is making sure every request stays inside the permissions the person granted. We also need to remove information when it is no longer needed. I would explain the design by following the diagram from user consent, through the .NET application and Meta systems, and back with only allowed data.

Useful Questions to Ask the Interviewer
  • Which Facebook data does this application actually need?
  • Which permissions must the user grant?
  • Does any requested permission require Meta App Review?
  • How long does the application need to retain returned data?
How do we respect privacy with the Facebook api? diagram
How to Explain It in an Interview
1. Start with consent and user control

I would start with the user because privacy begins with informed consent. The End User chooses to log in and authorize access using OAuth 2.0. The .NET application presents a consent screen that explains the requested scopes. A scope is simply a permission for a particular kind of access. The application should request only the scopes needed for the current feature. The diagram also keeps control with the user afterward. The user can manage permissions, revoke application access, delete data, and control related settings.

2. Keep the .NET application least-privileged

Inside the .NET application, I would secure access tokens and request only what the feature needs. The diagram shows secure token storage, short-lived tokens, and token rotation or refresh. It also shows least-privilege scopes and just-in-time requests. This reduces unnecessary access. The application collects minimum data, protects data in transit with TLS, encrypts stored data at rest, and limits internal access with RBAC. RBAC means only approved roles can access protected information.

3. Send the API request through the Meta API Gateway

The main request moves from the .NET application to the Meta API Gateway. The diagram labels this contract as HTTPS plus a bearer token with least-privilege scopes. HTTPS protects the request while it travels. The bearer token represents authorized access. The application should not request unrelated fields merely because the API could expose them. Keeping the request narrow makes the technical behavior match the purpose explained to the user.

4. Let Meta enforce permissions and policies

The Meta API Gateway validates the token, checks the app status, enforces rate limits, and enforces platform policies. After those checks, authorized data access moves from the gateway into Meta systems. The Permissions and Policy Engine validates permissions, applies platform policy checks, and handles App Review requirements. These controls belong to Meta rather than the .NET application. The diagram does not show a separate error response or fallback path. If these authorization checks do not allow the request, the authorized data-access step should not proceed.

5. Return only filtered, scoped data

Meta systems expose scoped user data rather than unrestricted information. The diagram shows field-level filtering and states that friends' data is not available without permission. Filtered data moves from Meta systems back to the Meta API Gateway within the permission boundaries. The gateway then returns the API response to the .NET application. That response contains only permitted data. This keeps the response path aligned with the user's consent and the permissions enforced by Meta.

6. Minimize, monitor, and delete data

After receiving data, the .NET application should retain only what it needs. The Data Lifecycle control says to keep data only as needed, delete it when it is no longer necessary, and respect user deletion. Logging and Monitoring records API access, helps detect abuse, and raises anomaly alerts. Compliance and Protection covers platform policies, privacy impact assessments, and regular reviews. These are supporting controls connected to the gateway. They are not part of the main synchronous API response path.

7. Explain the trade-off

The benefit of this design is smaller privacy exposure and stronger user control. The downside is extra work. Short-lived tokens require rotation or refresh handling. Least-privilege permissions can require another consent step when a new feature needs more data. Logging, deletion handling, access control, and compliance reviews also increase operational effort. I would accept that cost because the design keeps data access tied to consent, purpose, and Meta's permission boundaries.

Practical Complexity & Trade-offs

The main design choice is to expose and store less data instead of taking everything the API could provide. The benefit is lower privacy risk because requests stay inside the user's granted permissions. HTTPS protects data while it travels. Secure token storage and short-lived tokens reduce the risk from token misuse, but token rotation and refresh add work. Data minimization and deletion reduce long-term exposure, but the application needs good lifecycle handling. Meta also validates tokens, app status, permissions, rate limits, and platform policies before allowing access. Logging and compliance checks improve accountability, but they add operational cost. Least-privilege permissions can limit features or require new consent later. We accept these costs because user control and narrow permission boundaries are more important than convenience.

Why Interviewers Ask This

Interviewers ask this question to see whether you treat privacy as part of API design instead of an afterthought. They want judgment around consent, least privilege, secure token handling, data minimization, deletion, and user control. They also check whether you understand responsibility boundaries between the .NET application, the Meta API Gateway, and Meta's permission systems. A strong answer correctly explains the request and response flow while making practical privacy and security trade-offs.

Interviewer may ask next
What should happen if the user revokes the application's Facebook access?

The application should respect the revocation and stop depending on access that the user has withdrawn. The affected part of the diagram is the User Controls path, where the user can revoke app access, manage permissions, and delete data. The .NET application should also follow its Data Lifecycle controls by keeping information only as long as needed and respecting deletion. Future API requests still travel from the .NET application to the Meta API Gateway over HTTPS with the bearer token and scopes. Meta continues validating the token, app status, permissions, rate limits, and policies before allowing authorized data access. The design does not show a special revocation error code or fallback path, so I would not invent one. The important rule is that access must not bypass Meta's checks after the user's permissions change. Logging and Monitoring can continue recording relevant API activity for security and compliance. The downside is more lifecycle and state-management work, but the rest of the privacy design remains unchanged.

What if a new feature needs more Facebook data than the user originally permitted?

I would ask for the additional permission instead of silently expanding access. The affected parts are the consent flow, the least-privilege scopes inside the .NET application, and Meta's permission enforcement. First, I would check whether the extra data is truly required. If it is, the consent screen should clearly explain the new scope so the user can decide whether to grant it. The application should continue sending only granted scopes with its HTTPS request and bearer token. The Meta API Gateway still validates the token, app status, rate limits, and policies. Meta's Permissions and Policy Engine still validates permissions and any App Review requirements. If the additional permission is not available, the application should remain inside the existing permission boundary rather than reading unrelated data. The main downside is user friction because another consent step may be required. The benefit is that actual data access stays aligned with the purpose explained to the user.

More questions load as you scroll

Disclaimer: This interview guide is for educational and informational purposes only. It is designed to help readers prepare, but it does not guarantee any interview result, hiring decision, offer, or outcome. Interview questions, hiring criteria, and preferred answers can vary by employer, interviewer, industry, location, and time. The examples and explanations reflect the authors' research and judgment, are provided without warranties of any kind, and should not be treated as the only correct approach. Diagrams are simplified illustrations intended to highlight the main components and their interactions; actual systems and implementations may be more complex. Alternative approaches may be equally valid or better suited to a particular question, context, or interviewer. To the fullest extent permitted by applicable law, the author, contributors, and publisher are not liable for decisions made, actions taken, or losses incurred based on this guide.

Company Notice: This guide is an independent educational resource and is not affiliated with, endorsed by, sponsored by, or approved by the company named in this guide. Company names are used only to identify interview experiences commonly reported by candidates. Interview practices can change without notice, and inclusion of company-specific content does not mean these questions are official, complete, or guaranteed to be asked. To the fullest extent permitted by law, the author, contributors, and publisher are not responsible for outcomes related to use of this material.