Problem 61037. The MATLAB Treasure Hunt – Locate the Hidden Treasure in the Chamber of Coordinates

Inside the Chamber of Coordinates, glowing runes show several coordinate points on a 2D grid.
The treasure lies closest to the origin (0,0).
Given two numeric vectors x and y representing the coordinates of points, return the index of the point nearest to the origin.
If multiple points are equally close, return the smallest index.

Solution Stats

92.86% Correct | 7.14% Incorrect
Last Solution submitted on Oct 25, 2025

Solution Comments

Show comments

Problem Recent Solvers11

Suggested Problems

More from this Author22

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!