PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/LinkedIn

Find the k-th largest element in an array

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency with selection algorithms, array manipulation, and analysis of time and space complexity, reflecting competency in order-statistics and basic data structures.

  • medium
  • LinkedIn
  • Coding & Algorithms
  • Software Engineer

Find the k-th largest element in an array

Company: LinkedIn

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Given an integer array `nums` and an integer `k`, return the **k-th largest** element in the array. Notes: - The k-th largest element is the element that would appear in position `k` (1-indexed) if the array were sorted in **descending** order. - Do **not** fully sort the array unless you want to (but consider performance). ## Input - `nums`: array of integers - `k`: integer (`1 <= k <= len(nums)`) ## Output - The k-th largest integer. ## Constraints - `1 <= len(nums) <= 2 * 10^5` - `-10^9 <= nums[i] <= 10^9`

Quick Answer: This question evaluates proficiency with selection algorithms, array manipulation, and analysis of time and space complexity, reflecting competency in order-statistics and basic data structures.

Related Interview Questions

  • Count Trips From Vehicle Logs - LinkedIn (easy)
  • Design O(1) Randomized Multiset - LinkedIn (easy)
  • Process Mutable Matrix Sum Queries - LinkedIn (medium)
  • Design a Randomized Multiset - LinkedIn (medium)
  • Can You Place N Objects? - LinkedIn (medium)
LinkedIn logo
LinkedIn
Nov 21, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
10
0

Given an integer array nums and an integer k, return the k-th largest element in the array.

Notes:

  • The k-th largest element is the element that would appear in position k (1-indexed) if the array were sorted in descending order.
  • Do not fully sort the array unless you want to (but consider performance).

Input

  • nums : array of integers
  • k : integer ( 1 <= k <= len(nums) )

Output

  • The k-th largest integer.

Constraints

  • 1 <= len(nums) <= 2 * 10^5
  • -10^9 <= nums[i] <= 10^9

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More LinkedIn•More Software Engineer•LinkedIn Software Engineer•LinkedIn Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.