JinFei's Blog

Thinking will not overcome fear but action will.

[LeetCode]44. Wildcard Matching

通配符匹配

题目描述 Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for ‘?’ and ‘*’. '?' Matches any single character. '*' Matches any sequence of charac...

[LeetCode]4. Median of Two Sorted Arrays

合并两个排序的数组,找其中位数

题目描述 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume...

[LeetCode]315. Count of Smaller Numbers After Self

后面比本身小的个数

题目描述 You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i]. ...

[力扣]5377. 将二进制表示减到 1 的步骤数

字符串加减

题目描述 给你一个以二进制形式表示的数字 s 。请你返回按下述规则将其减少到 1 所需要的步骤数: 如果当前数字为偶数,则将其除以 2 。 如果当前数字为奇数,则将其加上 1 。 题目保证你总是可以按上述规则将测试用例变为 1 。 Example1: 输入:s = "1101" 输出:6 解释:"1101" 表示十进制数 13 。 Ste...

[LeetCode]329. Longest Increasing Path in a Matrix

dfs搜索

题目描述 Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or mo...

[LeetCode]140. Word Break II

递归搜索

题目描述 Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all suc...

[LeetCode]149. Max Points on a Line

最多的点的直线

题目描述 Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example1: Input: [[1,1],[2,2],[3,3]] Output: 3 Explanation: ^ | ...

[LeetCode]212. Word Search II

单词搜索

题目描述 Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are...

[LeetCode]10. Regular Expression Matching***

字符串匹配

题目描述 Given an input string (s) and a pattern (p), implement regular expression matching with support for ‘.’ and ‘*’. '.' Matches any single character. '*' Matches zero or more of the precedin...

[LeetCode]23. Merge k Sorted Lists

分治

题目描述 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example1: Input: [ 1->4->5, 1->3->4, 2->6 ]...