本文首发于我的个人博客:尾尾部落 题目描述 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。如果一条路…
分类:LeetCode
[Leetcode]23. 合并K个排序链表
题目描述: 合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 示例: 输入: [ 1->4->5, 1->3->4, 2->6 ] 输出: 1->1->2-…
Leetcode 230. Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may…
47. Permutations II
欢迎fork and star:Nowcoder-Repository-github 47. Permutations II 题目 Given a collection of numbers that might con…
[LeetCode] Sliding Puzzle 滑动拼图
On a 2×3 board, there are 5 tiles represented by the integers 1 through 5, and an empty squar…
LeetCode | Plus One
题目: Given a number represented as an array of digits, plus one to the number. 思路: 数组的遍历需要从右向左进行,然后结果存在临时数组中为从左…
【leetcode】48. Rotate Image 方块矩阵原地顺时针旋转90°
1. 题目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Foll…
Compute sum of digits in all numbers from 1 to n
Description: Compute sum of digits in all numbers from 1 to n Example: Input: n = 5 Output: Sum of digits in n…
[剑指offer] 合并两个排序的链表
题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。 解题思路 两种解法:递归和非递归 参考代码 /* public class ListNode { int val; …
[Mac]secureCRT私钥转换为mac ssh私钥
工作环境从win迁移到mac后,win上原来用secureCRT生成的key,在mac的iterm2中不能兼容使用,导致无法再mac下登录。报错如下: key_load_public:invalid format loa…
LeetCode 049 Group Anagrams
题目描述 Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat…
[Leetcode] Decode Ways 解码方式
Decode Ways 最新更新请见:https://yanjia.me/zh/2019/02/… A message containing letters from A-Z is being encoded…