YuAn


  • 首頁

  • 目錄

  • 分類

  • 標籤

  • 關於我

  • 檢索

2481. Minimum Cuts to Divide a Circle

發表於 2023-02-13 | 分類於 leetcode

problem

sloution

1
2
3
4
5
6
7
8
9
10
class Solution {
public:
int numberOfCuts(int n) {
// n, ret
// (1,0) (2,1) (3,3) (4,2) (5,5) (6,3) (7,7) (8,4) (9,9) (10,5)
if(n==1) return 0;
return n%2==0?n/2:n;

}
};

analysis

  • time complexity O(1)
  • space complexity O(1)
# Math
2483. Minimum Penalty for a Shop
2476. Closest Nodes Queries in a Binary Search Tree
  • 文章目錄
  • 本站概覽

642 文章
20 分類
53 標籤
GitHub E-Mail FB Page Instagram
近期文章
  • 1750. Minimum Length of String After Deleting Similar Ends
  • 948. Bag of Tokens
  • 2864. Maximum Odd Binary Number
  • 2570. Merge Two 2D Arrays by Summing Values
  • 1074. Number of Submatrices That Sum to Target
  1. 1. problem
  2. 2. sloution
  3. 3. analysis
© 2022 — 2024 YU-AN, Chen
由 Hexo 強力驅動
|
主題 — NexT.Mist v5.1.4