Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Latest commit

 

History

History
executable file
·
21 lines (10 loc) · 558 Bytes

Find_Three_Largest_Numbers.md

File metadata and controls

executable file
·
21 lines (10 loc) · 558 Bytes

Find Three Largest Numbers

Problem Statement

Write a function that takes in an array of integers and returns a sorted array of the three largest integers in the input array. Note that the function should return duplicate integers if necessary; for example, it should return [10, 10, 12] for an input array of [10, 5, 9, 10, 12]. Sample input: [141, 1, 17, -7, -17, -27, 18, 541, 8, 7, 7] Sample output: [18, 141, 541]

Explanation

We can use a Stack here

Solution

Check this Python code.