Nth Smallest Element

Find the nth smallest element in an array by sorting in ascending order.

Code

General
arr.sort[n - 1]

Parameters

Array of numbers

Position (1-indexed)

Server

More Ruby Snippets