{
  "app": {
    "name": "Mokabla",
    "url": "https://www.mokabla.com",
    "description": "Real interview questions from companies in Egypt, organised by company. Access is sold per company for 30 days."
  },
  "page": {
    "kind": "question",
    "title": "Question · k-distinct-window",
    "humanPath": "/en/c/microsoft/k-distinct-window",
    "humanOnly": false
  },
  "identity": {
    "class": "declared",
    "agent": "ClaudeBot",
    "operator": "Anthropic",
    "verified": false,
    "reason": "The user agent is ClaudeBot (Anthropic), which identifies itself as an AI agent.",
    "signals": [
      "Known agent user agent"
    ],
    "claimable": false
  },
  "state": {
    "question": {
      "slug": "k-distinct-window",
      "title": "K Distinct Window",
      "difficulty": "medium",
      "tags": [
        "coding",
        "oa",
        "swe",
        "intern"
      ],
      "is_free": true,
      "locked": false,
      "frequency": 0.5,
      "last_reported_at": "2026-07-23T11:54:29.490337Z",
      "url": "https://www.mokabla.com/en/c/microsoft/k-distinct-window",
      "agent": {
        "page": "https://www.mokabla.com/agent/en/c/microsoft/k-distinct-window",
        "question": "https://www.mokabla.com/agent/_call/get_question?company=microsoft&question=k-distinct-window"
      },
      "company": {
        "slug": "microsoft",
        "name_en": "Microsoft Egypt (ATLC)"
      },
      "body_md": "## Problem\nYou receive a string `s` and an integer `k`. Return the length of the longest contiguous substring of `s` that contains **at most `k` distinct characters**.\n\nI usually frame it as a log line: every character is an event type, and we want the longest stretch of the log that touches at most `k` different services.\n\n## Examples\n**Example 1**, `s = \"aabacbebebe\"`, `k = 3` → `7`\nThe window `\"cbebebe\"` holds `{c, b, e}` and has length 7. Extending it one step to the left pulls in `a` as a fourth type.\n\n**Example 2**, `s = \"aaaa\"`, `k = 1` → `4`\nThe whole string qualifies.\n\n**Edge**, `k = 0` → `0`, and an empty string → `0`.\n\n## Constraints\n- `1 <= len(s) <= 10^5`, lowercase ASCII.\n- `0 <= k <= 26`.\n- Target `O(n)` time and `O(k)` extra space.\n\n## What they look for\nTwo pointers plus a frequency map, shrinking from the left **only while** the distinct count exceeds `k`. The common slip is decrementing a count and forgetting to delete the key when it hits zero, which makes the distinct count wrong. Expect a follow-up asking for the substring itself rather than its length, and a question about why the loop is still linear even though there is a nested `while`.",
      "follow_ups_md": "- Return the substring itself, not just its length.\n- Characters arrive as a stream: keep answering after every character.\n- Exactly `k` distinct instead of at most `k`."
    },
    "paid": false,
    "access": "Question bodies are paid content: a person buys 30 days of access per company (200 EGP or 200 points) in the human app. Agents get titles, tags and difficulty; bodies only for free questions."
  },
  "actions": [
    {
      "name": "get_question",
      "description": "One question with its body. Bodies are paid content unless the question is free.",
      "permission": "allow",
      "sideEffect": "read",
      "input": {
        "company": "string",
        "question": "string"
      },
      "href": "https://www.mokabla.com/agent/_call/get_question?company=microsoft&question=k-distinct-window",
      "ready": true,
      "missing": [],
      "humanPath": "https://www.mokabla.com/en/pricing"
    },
    {
      "name": "list_questions",
      "description": "The questions reported at a company: titles, tags, difficulty, whether each is free or paid.",
      "permission": "allow",
      "sideEffect": "read",
      "input": {
        "company": "string",
        "page": "number?"
      },
      "href": "https://www.mokabla.com/agent/_call/list_questions?company=microsoft",
      "ready": true,
      "missing": []
    },
    {
      "name": "buy_access",
      "description": "Buy 30 days of access to a company.",
      "permission": "block",
      "reason": "This action is for people only",
      "ruleId": "R1",
      "sideEffect": "payment",
      "input": {
        "company": "string"
      },
      "href": "https://www.mokabla.com/agent/_call/buy_access?company=microsoft",
      "ready": true,
      "missing": [],
      "humanPath": "https://www.mokabla.com/en/pricing"
    },
    {
      "name": "post_comment",
      "description": "Comment on a question.",
      "permission": "block",
      "reason": "This action is for people only",
      "ruleId": "R1",
      "sideEffect": "write",
      "input": {
        "question": "string",
        "text": "string"
      },
      "href": "https://www.mokabla.com/agent/_call/post_comment?question=k-distinct-window",
      "ready": false,
      "missing": [
        "text"
      ],
      "humanPath": "https://www.mokabla.com/en/companies"
    }
  ],
  "navigate": [
    {
      "label": "This question, as data (free questions only)",
      "href": "https://www.mokabla.com/agent/_call/get_question?company=microsoft&question=k-distinct-window"
    },
    {
      "label": "All questions at this company",
      "href": "https://www.mokabla.com/agent/_call/list_questions?company=microsoft"
    },
    {
      "label": "The company page",
      "href": "https://www.mokabla.com/agent/en/c/microsoft"
    },
    {
      "label": "K Distinct Window · page",
      "href": "https://www.mokabla.com/agent/en/c/microsoft/k-distinct-window"
    }
  ],
  "notices": [
    {
      "severity": "info",
      "message": "This classification is final for the session: it came from a strong signal, not a guess. The human pages are not served to agents."
    },
    {
      "severity": "info",
      "message": "Unverified agents are read-only. Signed requests (Web Bot Auth) are the path to write access."
    }
  ],
  "meta": {
    "requestId": "ag_0055aa77f814",
    "policyVersion": "mokabla-2026-11-03",
    "generatedAt": "2026-11-03T15:53:50.516Z",
    "jsonUrl": "https://www.mokabla.com/agent/en/c/microsoft/k-distinct-window?format=json",
    "manifestUrl": "https://www.mokabla.com/.well-known/agentgate.json",
    "humanUrl": "https://www.mokabla.com/en/c/microsoft/k-distinct-window",
    "humanClaimUrl": "https://www.mokabla.com/agent/_claim/human?to=%2Fen%2Fc%2Fmicrosoft%2Fk-distinct-window"
  }
}