Allowed R6 · Within policy
{
"slug": "mst-network-cost",
"title": "Minimum Network Cost",
"difficulty": "medium",
"tags": [
"coding",
"algorithms-theory",
"oa",
"swe"
],
"is_free": true,
"locked": false,
"frequency": 0.25,
"last_reported_at": "2025-05-27T22:13:36.641343Z",
"url": "https://www.mokabla.com/en/c/nokia/mst-network-cost",
"agent": {
"page": "https://www.mokabla.com/agent/en/c/nokia/mst-network-cost",
"question": "https://www.mokabla.com/agent/_call/get_question?company=nokia&question=mst-network-cost"
},
"company": {
"slug": "nokia",
"name_en": "Nokia Egypt"
},
"body_md": "## What they ask\nThe timed online assessment for the Associate Software Engineer track in Cairo mixes general problem solving with a graph question built around Prim's algorithm. The link arrives by email roughly two weeks after the CV screen, and you get a window of only three to five days to sit it, so treat it like an exam you cannot reschedule.\n\nA representative version of the graph task: you are given `n` sites (numbered 0 to n-1) and a list of possible links between them, each with a cost. Return the minimum total cost of a set of links that connects every site, or `-1` if that is impossible.\n\n## Examples\n- `n = 4, links = [[0,1,1],[1,2,2],[0,2,4],[2,3,3]]` returns `6` (use 0-1, 1-2 and 2-3).\n- `n = 3, links = [[0,1,5]]` returns `-1` (site 2 can never be reached).\n\n## Constraints\n- `1 <= n <= 10^4`, `0 <= links.length <= 10^5`, costs are positive integers.\n- Duplicate links and self loops may appear and must not break your answer.\n\n## What they look for\n- You recognise a minimum spanning tree problem, can name both Prim and Kruskal, then pick one and implement it cleanly.\n- A priority-queue Prim in `O(E log V)`, or union-find Kruskal, with the disconnected case handled explicitly.\n- The same assessment had MCQ items on basic AI concepts and a SQL section, so budget your time; do not sink the whole window into this one problem.",
"follow_ups_md": "- How would you handle links that arrive while the algorithm is running?\n- What changes if costs can be zero or negative?\n- When would you prefer Kruskal over Prim, and why?",
"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."
}