Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Second largest · ⁨第二大⁩

English

Second largest

Return the second-biggest distinct value. Duplicates of the maximum don't count, so [5, 5, 4] gives 4, not 5.

One clean route: drop duplicates with set(...), sort the result, and take the value one in from the end with [-2].

ไทย

ค่ามากเป็นอันดับสอง

return ค่า 第二大 distinct. Duplicate ของ maximum ไม่ถูกนับ, ดังนั้น [5, 5, 4] ให้ 4, ไม่ใช่ 5

เส้นทางที่สะอาด: ลบ duplicate ด้วย set(...), sort ผลลัพธ์, และ lấyค่าหนึ่งจากท้ายด้วย [-2]

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP