Roy 的解題紀錄

Home Archives About
2023-05-10
解題區►Leetcode►Medium

Leetcode 59 - Spiral Matrix II

題目

Problem#

給你一個 $n \times n$ 的矩陣,要你按照螺旋順序填數字並回傳

  • 測資限制:
    • $1 \le n \le 20$

想法#

Read More

Share Comments
  • Leetcode
  • array
  • simulation
  • 解題紀錄
2023-05-09
解題區►Leetcode►Medium

Leetcode 54 - Spiral Matrix

題目

Problem#

給你一個 $n \times m$ 的矩陣,要你以迴旋順序回傳

  • 測資限制:
    • $1 \le m, n \le 10$
    • $-100 \le M[i] \le 100$

Read More

Share Comments
  • Leetcode
  • array
  • simulation
  • 解題紀錄
2023-05-08
解題區►Leetcode►Easy

Leetcode 1572 - Matrix Diagonal Sum

題目

Problem#

給你一個矩陣 mat 要你回傳對角的總和,重複的只要加一次就好

  • 測資限制:
    • $1 \le n \le 100$
    • $mat = nxn$
    • $1 \le mat[i][j] \le 100$

Read More

Share Comments
  • Leetcode
  • 解題紀錄
2023-05-05
解題區►Leetcode►Easy

Leetcode 1456 - Maximum Number of Vowels in a Substring of Given Length

題目

Problem#

給你一個字串 s 和一個正整數 k ,問你 s 的長度 k 的所有子字串中,其中母音的數量最大是多少?

  • 測資限制:
    • $1 \le s, k \le 10^5$

想法#

Read More

Share Comments
  • Leetcode
  • sliding window
  • 解題紀錄
2023-05-03
解題區►Leetcode►Easy

Leetcode 2215 - Find the Difference of Two Arrays

題目

Problem#

給你兩個 array nums1, nums2,要你回傳長度 2 的 vector<vector<int>> 答案陣列

  • ans[0] 是 nums1 中不重複且沒出現在 nums2 中的數字
  • ans[1] 是 nums2 中不重複且沒出現在 nums1 中的數字

測資限制:

Read More

Share Comments
  • Leetcode
  • 解題紀錄
2023-03-13
解題區►Leetcode►Easy

Leetcode 1523 - Count Odd Numbers in an Interval Range

題目

Problem#

給你兩個非負整數 low, high 問你介於兩者之間的奇數有多少個(包含)

  • 測資限制: $0 \le low \le high \le 10^9$

想法#

Read More

Share Comments
  • Leetcode
  • interval
  • math
  • 解題紀錄
2023-02-20
解題區►Leetcode►Medium

Leetcode 50 - Pow(x, n)

題目

Problem#

實作 pow(x, n) 意即 $x^n$

  • 測資限制:
    • $-100.0 < x < 100.0$
    • $-2^{31} \le n \le 2^{31}-1$
    • $-10^4 \le x^n \le 10^4$

想法#

Read More

Share Comments
  • Leetcode
  • 解題紀錄
2023-02-19
解題區►Leetcode►Medium

Leetcode 103 - Binary Tree Zigzag Level Order Traversal

題目

Problem#

給你一顆二元樹 root,問你回傳 zigzag 的順序

  • 測資限制:
    • $0 \le N \le 2000$

Read More

Share Comments
  • Leetcode
  • 解題紀錄
2023-02-06
解題區►Leetcode►Easy

Leetcode 1470 - Shuffle the Array

題目

Problem#

給你一個陣列 nums 有 2n 個元素 [x1, x2, ..., xn, y1, y2, ..., yn]

要你回傳 [x1, y1, x2, y2, ..., xn, yn]

  • 測資限制:
    • $1 \le n \le 500$
    • $1 \le nums[i] \le 10^3$

Read More

Share Comments
  • Leetcode
  • 解題紀錄
2023-02-05
解題區►Leetcode►Medium

Leetcode 438 - Find All Anagrams in a String

題目

Problem#

給你兩個字串 s1 和 s2,問你 s1 的排列組合是不是 s2 的子字串,回傳所有的 index

1
2
s = "cbaebabacd", p = "abc"
// output [0, 6]
  • 測資限制:
    • $1 \le len \le 3\cdot10^4$

Read More

Share Comments
  • Leetcode
  • hashmap
  • sliding window
  • string
  • 解題紀錄
« Prev1…1112131415…23Next »

Categories

  • 解題區
    • CSES
      • Introductory Problems
    • Leetcode
      • Easy
      • Hard
      • Medium
    • Uva

Tags

  • 2D 格子
  • BFS
  • Bit Manipulation
  • CSES
  • Class
  • DP
  • Design
  • Game Thoery
  • LCS
  • LIS
  • Leetcod
  • Leetcode
  • Stack
  • Uva
  • array
  • backtracking
  • bfs
  • binary search
  • bitwise 枚舉
  • bst
  • cycle
  • cycle detection
  • dfs
  • dijkstra
  • disjoint set
  • geometry
  • graph
  • greedy
  • hashmap
  • interval
  • linked list
  • map
  • math
  • matrix
  • matrixe
  • minumum spanning tree
  • monotonic stack
  • ordered set
  • prefix sum
  • priority queue
  • simulation
  • sliding window
  • sort
  • sorting
  • stack
  • string
  • 二分圖
  • 二分答案
  • 暴搜
  • 背包
  • 著色問題
  • 解題紀錄
  • 雙指標

Tag Cloud

2D 格子 BFS Bit Manipulation CSES Class DP Design Game Thoery LCS LIS Leetcod Leetcode Stack Uva array backtracking bfs binary search bitwise 枚舉 bst cycle cycle detection dfs dijkstra disjoint set geometry graph greedy hashmap interval linked list map math matrix matrixe minumum spanning tree monotonic stack ordered set prefix sum priority queue simulation sliding window sort sorting stack string 二分圖 二分答案 暴搜 背包 著色問題 解題紀錄 雙指標

Archives

  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • July 2022
  • March 2022
  • February 2022
  • May 2021
  • March 2021
  • September 2019
  • June 2019
  • May 2019
  • February 2019

Recent Posts

  • Leetcode 2181 - Merge Nodes in Between Zeros
  • Leetcode 1509 - Minimum Difference Between Largest and Smallest Value in Three Moves
  • Leetcode 409 - Longest Palindrome
  • Leetcode 1863 - Sum of All Subset XOR Totals
  • Leetcode 861 - Score After Flipping Matrix
© 2024 Roy
Powered by Hexo
Home Archives About