代码改变世界

随笔档案-2021年8月22日

[LeetCode] 259. 3Sum Smaller_Medium tag: Two pointers

2021-08-22 09:22 by Johnson_强生仔仔, 33 阅读, 收藏,
摘要: Given an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition  阅读全文

[LeetCode] 59. Spiral Matrix II_Medium tag: array, DFS

2021-08-22 07:23 by Johnson_强生仔仔, 52 阅读, 收藏,
摘要: Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: Input: n = 3 Output: [[1,2,3],[8,9, 阅读全文

[LeetCode] 54. Spiral Matrix_Medium tag: array, DFS

2021-08-22 07:13 by Johnson_强生仔仔, 38 阅读, 收藏,
摘要: Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,3,6,9,8,7, 阅读全文

[LeetCode] 766. Toeplitz Matrix_Easy tag: array

2021-08-22 02:34 by Johnson_强生仔仔, 45 阅读, 收藏,
摘要: Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false. A matrix is Toeplitz if every diagonal from top-left to bottom- 阅读全文