- 博客(13)
- 收藏
- 关注
原创 Leetcode Programming Skills [896 | 28]
896.Monotonic ArrayGiven an integer arraynums, returntrueif the given array is monotonic, orfalseotherwise.Solution 1:class Solution: def isMonotonic(self, nums): nums_pos, nums_neg = list(nums), list(nums) nums_pos.sort()...
2022-03-12 17:03:18 104
原创 Leetcode Data Structure [290 | 763]
290.Word PatternGiven a pattern and a string s, find if s follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s.Solution:class Solution: def wordPattern(s.
2022-03-12 16:39:43 90
原创 Leetcode Data Structure [415 | 409]
415.Add StringsGiven two non-negative integers,num1andnum2represented as string, returnthe sum ofnum1andnum2as a string.You must solve the problem without using any built-in library for handling large integers (such asBigInteger). You must a...
2022-03-04 00:33:11 159
原创 Leetcode Data Structure [334 | 238 | 560]
334.Increasing Triplet SubsequenceQuestion:Given an integer arraynums, returntrueif there exists a triple of indices(i, j, k)such thati < j < kandnums[i] < nums[j] < nums[k]. If no such indices exists, returnfalse.Solution:cl...
2022-03-04 00:28:40 429
原创 Leetcode Data Structure [240 | 435]
Leetcode Data Structure [240 | 435\240.Search a 2D Matrix IIWrite an efficient algorithm that searches for a valuetargetin anm x ninteger matrixmatrix. This matrix has the following properties:Integers in each row are sorted in ascending from l...
2022-02-24 21:12:40 268
原创 Leetcode Data Structure [119 | 48]
def getRow(rowIndex): form = [1] * (rowIndex + 1) for i in range(2, rowIndex+1): for j in range(1, i): form[i-j] += form[i-j-1] return form"""Remark: Process: i | j | form 2 | 1 | [1, 2, 1, 1, 1.
2022-02-24 01:43:52 241
原创 Leetcode Data Structure [75 | 56 ]
75.Sort ColorsGiven an arraynumswithnobjects colored red, white, or blue, sort themin-placeso that objects of the same color are adjacent, with the colors in the order red, white, and blue.We will use the integers0,1, and2to represent the ...
2022-02-22 23:47:38 236
原创 Leetcode Data Structure [136 | 169 | 15]
136.Single NumberGiven a non-empty array of integers nums, every element appears twice except for one. Find that single one.You mustimplement a solution with a linear runtime complexity and useonly constantextra space.class Solution: def...
2022-02-21 02:52:49 65
原创 Leetcode Data Structure [387 | 383 | 242]
387.First Unique Character in a StringGiven a strings,find the first non-repeating character in it and return its index. If it does not exist, return-1.Solution 1:class Solution: def firstUniqChar(self, s): for i in s: ...
2022-02-18 20:15:46 139
原创 Leetcode Data Structure [566 | 118]
[Data Structure Study Plan] - Day 4566.Reshape the MatrixIn MATLAB, there is a handy function calledreshapewhich can reshape anm x nmatrix into a new one with a different sizer x ckeeping its original data.You are given anm x nmatrixmatand...
2022-02-18 04:05:23 929
原创 Leetcode Data Structure [36 | 74]
[Data Structure Study Plan] - Day 336. Valid SudokuDetermine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must cont...
2022-02-18 01:25:44 232
原创 Leetcode Data Structure [350 | 121]
[Data Structure Study Plan] - Day 2350.Intersection of Two Arrays IIGiven two integer arraysnums1andnums2, returnan array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the...
2022-02-13 23:00:49 241
原创 Leetcode Data Structure [217 | 53 | 1 | 88]
[Data Structure Study Plan] - Day 1[Problem 1]217. Contains DuplicateGiven an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.Solution 1.class Solution: def co...
2022-02-08 06:13:04 59
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人