NeetCode #738LC-1395Medium2-D Dynamic Programming
← Back to All Problems

#738 · #1395 · Count Number of Teams(统计作战单位数)

📌 Problem Statement & Constraints

There are n soldiers with ratings rating[i]. A team of three indices i < j < k is valid if their ratings are strictly increasing or strictly decreasing. Return the number of valid teams. Constraints: 3 <= n <= 1000, 1 <= rating[i] <= 10^5.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!