diff --git a/problems/3025-find-the-number-of-ways-to-place-people-i/README.md b/problems/3025-find-the-number-of-ways-to-place-people-i/README.md new file mode 100644 index 0000000..053c910 --- /dev/null +++ b/problems/3025-find-the-number-of-ways-to-place-people-i/README.md @@ -0,0 +1,70 @@ +# [3025] Find The Number Of Ways To Place People I + +## 題目資訊 +- **難度**: Medium +- **標籤**: Array, Math, Geometry, Sorting, Enumeration +- **題目連結**: [LeetCode](https://leetcode.com/problems/find-the-number-of-ways-to-place-people-i/) +- **練習日期**: 2025-09-02 + +## 題目描述 +You are given a 2D array `points` of size `n x 2` representing integer coordinates of some points on a 2D plane, where `points[i] = [xi, yi]`. + +Count the number of pairs of points `(A, B)`, where + - `A` is on **the upper** left side of `B`, and + - there are no other points in the rectangle (or line) they make (**including the border**). + +Return the count. + +## 解題思路 + +### 初步分析 +- 這題主要考察什麼概念? +- 有什麼關鍵限制條件? +- 預期時間/空間複雜度? + +### 解法概述 +1. **暴力解法**: + - 思路: + - 時間複雜度:O(?) + - 空間複雜度:O(?) + +2. **優化解法**: + - 思路: + - 時間複雜度:O(?) + - 空間複雜度:O(?) + +## 測試案例 + +### 範例輸入輸出 +``` +Input: points = [[6,2],[4,4],[2,6]] +Output: 2 +Explanation: + - The left one is the pair (points[1], points[0]), where points[1] is on the upper left side of points[0] and the rectangle is empty. + - The left one is the pair (points[1], points[0]), where points[1] is on the upper left side of points[0] and the rectangle is empty. + - The right one is the pair (points[2], points[0]), where points[2] is on the upper left side of points[0], but points[1] is inside the rectangle so it's not a valid pair. +``` + +### 邊界情況 +- `2 <= n <= 50` +- `points[i].length == 2` +- `0 <= points[i][0], points[i][1] <= 50` +- All `points[i]` are distinct. + +## 學習筆記 + +### 今天學到什麼? +- + +### 遇到的困難 +- + +### 改善方向 +- + +### 相關題目 +- [題目編號] 題目名稱 - 相似概念 +- [題目編號] 題目名稱 - 進階版本 + +--- +**總結**: 這題的核心概念是...,適合練習...技巧。 diff --git a/problems/3025-find-the-number-of-ways-to-place-people-i/csharp/Program.cs b/problems/3025-find-the-number-of-ways-to-place-people-i/csharp/Program.cs new file mode 100644 index 0000000..62d8ffc --- /dev/null +++ b/problems/3025-find-the-number-of-ways-to-place-people-i/csharp/Program.cs @@ -0,0 +1,36 @@ +// LeetCode 3025: Find The Number Of Ways To Place People I +// 難度: Medium +// 日期: 2025-09-02 + +using System; +using System.Collections.Generic; +using System.Linq; + +public class Solution { + public void Solve() { + // TODO: 實作解法 + Console.WriteLine("Hello LeetCode 3025!"); + } +} + +// 測試程式 +public class Program { + public static void Main() { + Solution sol = new Solution(); + sol.Solve(); + + // TODO: 加入測試案例 + // TestCase1(); + // TestCase2(); + } + + // 測試案例模板 + /* + static void TestCase1() { + // Input: + // Expected: + // Actual: + Console.WriteLine("Test 1: "); + } + */ +} diff --git a/problems/3025-find-the-number-of-ways-to-place-people-i/csharp/csharp.csproj b/problems/3025-find-the-number-of-ways-to-place-people-i/csharp/csharp.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/problems/3025-find-the-number-of-ways-to-place-people-i/csharp/csharp.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/problems/3025-find-the-number-of-ways-to-place-people-i/test/SolutionTests.cs b/problems/3025-find-the-number-of-ways-to-place-people-i/test/SolutionTests.cs new file mode 100644 index 0000000..b7edff4 --- /dev/null +++ b/problems/3025-find-the-number-of-ways-to-place-people-i/test/SolutionTests.cs @@ -0,0 +1,43 @@ +// LeetCode 3025 單元測試 +// 使用 xUnit 框架 + +using Xunit; +using System; +using System.Collections.Generic; + +public class SolutionTests { + private readonly Solution _solution; + + public SolutionTests() { + _solution = new Solution(); + } + + [Fact] + public void TestCase1() { + // Arrange + // TODO: 設定輸入資料 + // var input = ; + // var expected = ; + + // Act + // var result = _solution.YourMethod(input); + + // Assert + // Assert.Equal(expected, result); + + Assert.True(true); // 暫時通過,等待實作 + } + + [Fact] + public void TestCase2() { + // TODO: 第二個測試案例 + Assert.True(true); + } + + [Fact] + public void TestEdgeCases() { + // TODO: 邊界情況測試 + // 空陣列、單一元素、最大值、最小值等 + Assert.True(true); + } +} diff --git a/problems/3025-find-the-number-of-ways-to-place-people-i/test/TestProject.csproj b/problems/3025-find-the-number-of-ways-to-place-people-i/test/TestProject.csproj new file mode 100644 index 0000000..2f44c14 --- /dev/null +++ b/problems/3025-find-the-number-of-ways-to-place-people-i/test/TestProject.csproj @@ -0,0 +1,22 @@ + + + + net8.0 + enable + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/problems/3025-find-the-number-of-ways-to-place-people-i/test/edge_cases.md b/problems/3025-find-the-number-of-ways-to-place-people-i/test/edge_cases.md new file mode 100644 index 0000000..977c4c5 --- /dev/null +++ b/problems/3025-find-the-number-of-ways-to-place-people-i/test/edge_cases.md @@ -0,0 +1,21 @@ +# 邊界情況清單 + +## 需要測試的邊界情況 +- [ ] 空輸入 (空陣列、空字串等) +- [ ] 單一元素 +- [ ] 重複元素 +- [ ] 最大值/最小值 +- [ ] 負數情況 +- [ ] 超大資料量 +- [ ] 特殊字符 (如果是字串題目) + +## 額外測試案例 +### 案例 1: +**輸入**: +**輸出**: +**說明**: + +### 案例 2: +**輸入**: +**輸出**: +**說明**: