← Applied intuition Interview Insights

Applied intuition·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Applied Intuition coding screen for a software engineer role. One question, but it had enough moving parts to keep you busy for a while.

Questions Asked (1)

Q1

Given a message definition string where each line specifies a field name and its type, implement a parser that supports two operations: returning the size in bytes for a given field name, primitive type, or user-defined message type; and returning the type string for a given field name.

Algorithms & Data StructuresAPI & IntegrationsSystem Design
Author's notes

The setup sounds manageable until you realize get_size has to handle three different kinds of inputs and you need to figure out which one you're dealing with at query time.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the message definition format and the exact operations required, then design a two-pass parser that first builds a symbol table of user-defined types and then resolves field sizes and types. Use a recursive resolution strategy with memoization to handle nested user-defined types and detect cycles.

Pro tip: Explicitly discuss error handling for undefined types, duplicate definitions, and cyclic dependencies—this shows production-level thinking and often impresses interviewers more than the happy path.

1. Clarify Requirements and Format

Ask about the exact syntax of the message definition string (e.g., 'fieldName: type', indentation for nesting) and confirm the expected behavior for edge cases like unknown fields or types.

2. Design Data Structures

Plan to store parsed definitions in a map from type name to its fields, and a map from field name to its type within each message. Consider using a trie or nested maps for efficient lookup.

3. Parse the Definition String

Implement a parser that reads line by line, extracts field names and types, and builds the symbol table. Handle indentation or delimiters to capture nested message definitions.

4. Implement Size and Type Resolution

For size queries, recursively compute the size of user-defined types by summing field sizes, using memoization to avoid recomputation and detect cycles. For type queries, simply look up the field's type in the symbol table.

5. Handle Errors and Edge Cases

Add checks for undefined types, duplicate field names, and cyclic dependencies. Return appropriate errors or exceptions as needed.

Key Points to Mention

  • Primitive type sizes (e.g., int32 = 4 bytes, string = variable length) and how to handle variable-length types
  • Recursive resolution of user-defined types with memoization to optimize repeated size queries
  • Cycle detection to prevent infinite recursion in type definitions
  • Efficient lookup using hash maps for O(1) average-case access
  • Error handling for undefined types, duplicate definitions, and malformed input
  • API design: separate methods for getSize and getType, with clear input/output contracts

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