Logo

Coding preview

The lazy ahh student

What this preview is

About this preview

The lazy ahh student is a medium quant coding problem on language knowledge in Cpp.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Solving this medium C++ routing optimization problem

This is a medium-difficulty coding problem that tests your ability to find an optimal tour through a small set of waypoints. The constraint that you must visit every location exactly once, combined with a small upper bound on the number of tasks, hints at a brute-force or dynamic-programming approach rather than a greedy heuristic.

The core challenge is exploring the solution space efficiently: with up to 8 tasks, the number of possible orderings is manageable, but you need to compute Euclidean distances accurately and compare routes systematically. A well-structured solution will clearly separate the distance calculation, permutation generation, and aggregation logic, making it easy to verify correctness on edge cases like empty task lists or collinear points.

  • Permutation enumeration and backtracking
  • Floating-point arithmetic and distance computation
  • State-space search with manageable branching factor
  • Handling boundary conditions (no tasks, start equals end)