PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Microsoft

Implement four data-structure/string geometry tasks

Last updated: Mar 29, 2026

Quick Overview

This multi-part question evaluates manual big-integer string multiplication, robust parsing and tokenization of complex log formats, computational geometry for axis-aligned rectangle detection, and dynamic data-structure design for time-series updates and aggregate queries.

  • medium
  • Microsoft
  • Coding & Algorithms
  • Software Engineer

Implement four data-structure/string geometry tasks

Company: Microsoft

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem A — Multiply two non-negative integer strings You are given two strings `num1` and `num2` representing non-negative integers in base-10. - Return their product as a base-10 string. - You **must not** convert the inputs to built-in integer/big-integer types. - The output must not contain leading zeros (unless the value is exactly `"0"`). **Input:** `num1`, `num2` (strings) **Output:** product as a string **Constraints (typical):** `1 <= len(num1), len(num2) <= 10^4`, digits only. --- ## Problem B — Parse email addresses from a huge log string You are given a very large string `s` that contains multiple **records**. Conceptually: - Records are separated by a semicolon `;` **only when the semicolon is not inside**: - double quotes `"..."` (display name), or - parentheses `(...)` (a comment). - Each record corresponds to one email entry, but the record can contain optional parts: - an optional display name (possibly quoted), - an email address token containing exactly one `@`, - optional comments in parentheses, and a comment may appear **anywhere** in the record. **Task:** Extract all email addresses from the string and return a **deduplicated** list. - If an email appears multiple times, keep only the first occurrence. - You may assume the email address itself does not contain spaces/semicolons/parentheses/quotes. **Input:** one string `s` **Output:** list of unique email strings --- ## Problem C — Maximum area axis-aligned rectangle from points You are given `N` distinct points on a 2D integer grid: `points[i] = (xi, yi)`. A rectangle is **axis-aligned** (sides parallel to axes). A valid rectangle requires all four corners to be present in the input set. **Task:** Return the maximum rectangle area possible. If no rectangle can be formed, return `0`. **Input:** array of points **Output:** integer maximum area (or `0`) **Constraints (typical):** `1 <= N <= 2000` (or similar), coordinates fit in 32-bit signed int. --- ## Problem D — Stock price tracker with corrections Design a data structure supporting these operations: - `update(timestamp, price)`: record the stock price at `timestamp`. - If the timestamp already exists, this call **overwrites/corrects** the previous price. - `current()`: return the latest stock price (price at the maximum timestamp seen so far). - `maximum()`: return the maximum price among all timestamps currently stored. - `minimum()`: return the minimum price among all timestamps currently stored. **Input:** sequence of operations **Output:** values returned by `current/maximum/minimum` **Constraints (typical):** up to `2e5` operations; timestamps and prices are positive integers.

Quick Answer: This multi-part question evaluates manual big-integer string multiplication, robust parsing and tokenization of complex log formats, computational geometry for axis-aligned rectangle detection, and dynamic data-structure design for time-series updates and aggregate queries.

Related Interview Questions

  • Sort Three Categories In Place - Microsoft (medium)
  • Implement K-Means and Detect Divisible Subarrays - Microsoft (medium)
  • Implement SFT Sample Packing - Microsoft (medium)
  • Implement SQL Table and DNA Ordering - Microsoft (medium)
  • Solve power jumps and graph tour - Microsoft (hard)
Microsoft logo
Microsoft
Feb 12, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
1
0
Loading...

Problem A — Multiply two non-negative integer strings

You are given two strings num1 and num2 representing non-negative integers in base-10.

  • Return their product as a base-10 string.
  • You must not convert the inputs to built-in integer/big-integer types.
  • The output must not contain leading zeros (unless the value is exactly "0" ).

Input: num1, num2 (strings)

Output: product as a string

Constraints (typical): 1 <= len(num1), len(num2) <= 10^4, digits only.

Problem B — Parse email addresses from a huge log string

You are given a very large string s that contains multiple records. Conceptually:

  • Records are separated by a semicolon ; only when the semicolon is not inside :
    • double quotes "..." (display name), or
    • parentheses (...) (a comment).
  • Each record corresponds to one email entry, but the record can contain optional parts:
    • an optional display name (possibly quoted),
    • an email address token containing exactly one @ ,
    • optional comments in parentheses, and a comment may appear anywhere in the record.

Task: Extract all email addresses from the string and return a deduplicated list.

  • If an email appears multiple times, keep only the first occurrence.
  • You may assume the email address itself does not contain spaces/semicolons/parentheses/quotes.

Input: one string s

Output: list of unique email strings

Problem C — Maximum area axis-aligned rectangle from points

You are given N distinct points on a 2D integer grid: points[i] = (xi, yi).

A rectangle is axis-aligned (sides parallel to axes). A valid rectangle requires all four corners to be present in the input set.

Task: Return the maximum rectangle area possible. If no rectangle can be formed, return 0.

Input: array of points

Output: integer maximum area (or 0)

Constraints (typical): 1 <= N <= 2000 (or similar), coordinates fit in 32-bit signed int.

Problem D — Stock price tracker with corrections

Design a data structure supporting these operations:

  • update(timestamp, price) : record the stock price at timestamp .
    • If the timestamp already exists, this call overwrites/corrects the previous price.
  • current() : return the latest stock price (price at the maximum timestamp seen so far).
  • maximum() : return the maximum price among all timestamps currently stored.
  • minimum() : return the minimum price among all timestamps currently stored.

Input: sequence of operations

Output: values returned by current/maximum/minimum

Constraints (typical): up to 2e5 operations; timestamps and prices are positive integers.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Microsoft•More Software Engineer•Microsoft Software Engineer•Microsoft Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.