Leetcode 611. Valid Triangle Number
Count the number of triplets (i, j, k) from nums that can form triangle side lengths — i.e., three values a ≤ b ≤ c must satisfy a + b > c. With n ≤ 1000 the key is to enforce the triangle inequality efficiently (commonly by sorting and using a two‑pointer counting pattern to achieve O(n^2) rather than O(n^3)).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.