← Okta Interview Insights

Okta·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Okta SWE interview that leaned hard into string validation and networking basics. The IPv4 problem was straightforward enough but the follow-up asking you to also handle IPv6 and classify strings is where things got interesting.

Questions Asked (2)

Q1

Given an array of strings, write a function that returns True if every string is a valid IPv4 address, and False otherwise. A valid IPv4 address has exactly four dot-separated octets, each containing only digits, no leading zeros, and a value between 0 and 255.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Seemed simple at first and I jumped straight to splitting on '.' without thinking through edge cases.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the exact rules for a valid IPv4 address, including edge cases like leading zeros and empty strings. Then, outline a function that splits each string by dots, checks that there are exactly four parts, and validates each part using digit checks and range validation. Finally, discuss how to handle multiple strings efficiently and test with edge cases.

Pro tip: Mention that you would avoid using regular expressions for this problem because they can be error-prone and less readable, and instead use straightforward string manipulation and integer conversion for clarity and performance.

1. Clarify requirements and edge cases

Ask the interviewer to confirm the rules: exactly four octets, digits only, no leading zeros (except '0' itself), and values 0-255. Also consider empty strings, strings with extra dots, and non-numeric characters.

2. Design the validation function

Outline a function that takes a string, splits it by '.', and checks that the resulting array has exactly four elements. For each element, verify it is non-empty, contains only digits, has no leading zeros (unless it is '0'), and its integer value is between 0 and 255.

3. Implement the solution

Write code that iterates over the input array of strings, applying the validation function to each. Return True only if all strings are valid; otherwise return False. Use early termination for efficiency.

4. Test with edge cases

Run through test cases: valid addresses like '192.168.0.1', invalid ones like '256.100.50.0', '192.168.1', '192.168.1.1.1', '192.168.01.1', and empty strings. Verify the function returns the expected results.

5. Discuss complexity and trade-offs

Analyze time complexity: O(n*m) where n is the number of strings and m is the average length. Mention that the solution is optimal for this problem, and discuss potential trade-offs if using regex or built-in parsing functions.

Key Points to Mention

  • Exactly four octets separated by dots
  • Each octet must be a non-empty string of digits only
  • No leading zeros unless the octet is '0'
  • Each octet's integer value must be between 0 and 255
  • Handle edge cases like empty strings, extra dots, and non-numeric characters
  • Time complexity is O(n*m) and space complexity is O(1) per string

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

Q2

Follow-up: extend your solution to also detect IPv6 addresses, and classify each input string as 'IPv4', 'IPv6', or 'Neither'.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is basically LC 468 and I half-knew it but couldn't remember the IPv6 rules cleanly under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the exact requirements: should IPv6 support include compressed forms (::), IPv4-mapped addresses, and zone IDs? Then outline a modular validation approach where you first attempt IPv4 validation, then IPv6, and return the appropriate classification. Emphasize that you'll reuse the existing IPv4 logic and add a separate IPv6 validator, discussing trade-offs between regex and manual parsing.

Pro tip: Mention that you'd handle edge cases like leading zeros in IPv4 (which are invalid in strict mode) and IPv6's '::' compression, and that you'd write unit tests for each case. This shows attention to detail and production readiness.

1. Clarify requirements and edge cases

Ask whether IPv6 validation should accept compressed forms, IPv4-mapped addresses, and zone indices. Confirm if strict IPv4 (no leading zeros) is required.

2. Design modular validation functions

Keep the existing IPv4 validator and add a separate IPv6 validator. The main function calls IPv4 first, then IPv6, and returns 'Neither' if both fail.

3. Implement IPv6 validation

Use a regex or manual parsing to handle 8 groups of 4 hex digits, '::' compression, and optional IPv4 suffix. Ensure it rejects invalid patterns like multiple '::'.

4. Test and discuss trade-offs

Write unit tests covering valid/invalid IPv4, IPv6, and edge cases. Discuss performance and readability trade-offs between regex and manual parsing.

Key Points to Mention

  • IPv6 address format: 8 groups of 16-bit hex, separated by colons, with '::' compression for zero groups.
  • IPv4-mapped IPv6 addresses (e.g., ::ffff:192.0.2.1) and how to handle them.
  • Edge cases: leading zeros in IPv4, multiple '::' in IPv6, zone IDs (e.g., %eth0), and case-insensitivity of hex digits.
  • Modular design: separate validators for IPv4 and IPv6, with a clear classification function.
  • Trade-offs: regex simplicity vs. manual parsing control and performance.
  • Testing strategy: unit tests for each category and edge cases, including boundary values.

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