// LeetCode 3025: Find The Number Of Ways To Place People I // 難度: Medium // 日期: 2025-09-02 package main import "fmt" // TODO: 實作解法 func numberOfPairs(points [][]int) int { n := len(points) count := 0; for i:= 0; i < n; i++{ for j := 0; j < n; j++{ if i == j { continue } pointA := points[i] pointB := points[j] if pointA[0] <= pointB[0] && pointA[1] >= pointB[1] { hasOtherPoint := false; minX := pointA[0] maxX := pointB[0] minY := pointB[1] maxY := pointA[1] for k := 0; k < n; k++{ if i == k || j == k{ continue } pointC := points[k] if minX <= pointC[0] && pointC[0] <= maxX && minY <= pointC[1] && pointC[1] <= maxY{ hasOtherPoint = true break } } if !hasOtherPoint{ count++ } } } } return count; } func main() { testCase() } // 測試案例模板 func testCase() { // Input: points := [][]int{ {6, 2}, {4, 4}, {2, 6}, } // Expected: fmt.Printf("Test Case: [[6,2],[4,4],[2,6]]\n") fmt.Printf("Expected: 2\n") // Actual: result := numberOfPairs(points) fmt.Printf("Result: %d\n", result) }