AGENT CALL · Mokabla · get_question
request ag_b45f5f4b76dd

Decision

Allowed   R6 · Within policy

input
{"company":"synopsys","question":"sorting-and-search-screen"}

Result

{
  "slug": "sorting-and-search-screen",
  "title": "Sorting And Search Screen",
  "difficulty": "easy",
  "tags": [
    "coding",
    "algorithms-theory",
    "oa",
    "swe"
  ],
  "is_free": true,
  "locked": false,
  "frequency": 0.6,
  "last_reported_at": "2026-02-08T11:17:23.266301Z",
  "url": "https://www.mokabla.com/en/c/synopsys/sorting-and-search-screen",
  "agent": {
    "page": "https://www.mokabla.com/agent/en/c/synopsys/sorting-and-search-screen",
    "question": "https://www.mokabla.com/agent/_call/get_question?company=synopsys&question=sorting-and-search-screen"
  },
  "company": {
    "slug": "synopsys",
    "name_en": "Synopsys"
  },
  "body_md": "## Problem\nThe first filter for the software and R&D roles is a written or online test followed by a basic data structures and algorithms interview. Reports are consistent about the content: sorting, binary search, and time complexity. It is not hard, and it is where a lot of people get eliminated anyway because they treated it as a formality.\n\nThe representative task: given a sorted array that has been rotated an unknown number of times, find a target in `O(log n)`.\n\n## Examples\n**Example 1**, `nums = [4,5,6,7,0,1,2]`, `target = 0` returns `4`.\n\n**Example 2**, `nums = [4,5,6,7,0,1,2]`, `target = 3` returns `-1`.\n\n**Example 3**, `nums = [1]`, `target = 1` returns `0`.\n\n**Example 4**, `nums = [3,1]`, `target = 1` returns `1`. The two element case is where most wrong implementations die.\n\n## Constraints\n- `1 <= n <= 5000`, distinct integers.\n- `O(log n)` required. A linear scan passes the tests and fails the interview.\n- Then state the complexity of what you wrote, and justify it rather than asserting it.\n\n## What they look for\nA correct binary search with the invariant said out loud, because the mistake is almost never the idea and almost always the boundary. Decide up front whether your range is inclusive or half open and stay with it.\n\nThe follow ups are about complexity literacy, which the reports mention specifically:\n\n- Time complexity of several named algorithms, on the spot. Quicksort average and worst, mergesort, heapsort, insertion sort on nearly sorted input.\n- Why quicksort is the practical default despite the quadratic worst case, and what a library implementation does to avoid it.\n- Which sort is stable and when you care.\n- Space complexity, including the recursion stack, which people forget to count.\n- Sorting a dataset larger than memory, which is a genuinely relevant question here because the tools routinely handle designs that do not fit.\n\nThere is often a **logic puzzle** at the end of the round, and it is a fixture of this company's loop rather than a one off. Treat it as a thinking out loud exercise and narrate your reasoning.",
  "follow_ups_md": "- Now the array may contain duplicates. What breaks and what is the new worst case?\n- Find the rotation point instead of the target.\n- Which sorting algorithm would you use for a nearly sorted array of ten million elements, and why?\n- The data does not fit in memory. How do you sort it?",
  "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."
}

Navigate (pre-filled links you can follow)