文章 222
评论 10
浏览 159803
79. 单词搜索

79. 单词搜索

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

LinkedList - 25. Reverse Nodes in k-Group

LinkedList - 25. Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.

1143. Longest Common Subsequence

1143. Longest Common Subsequence

Given two strings text1 and text2, return common subsequence. If there is no common subsequence, return 0.

Array - 88. Merge Sorted Array

Array - 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

通过先序和中序数组生成后序数组

通过先序和中序数组生成后序数组

通过先序和中序数组生成后序数组

138. Copy List with Random Pointer

138. Copy List with Random Pointer

A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null.Construct a deep copy of the list.

1335. Minimum Difficulty of a Job Schedule

1335. Minimum Difficulty of a Job Schedule

You want to schedule a list of jobs in d days. Jobs are dependent (i.e To work on the i-th job, you have to finish all the jobs j where 0 <= j < i).

Palindrome - 125. Valid Palindrome

Palindrome - 125. Valid Palindrome

Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

DFS&BFS - 51. N-Queens

DFS&BFS - 51. N-Queens

The n-queens puzzle is the problem of placing n queens on an n_×_n chessboard such that no two queens attack each other.

Dynamic Programming - 322. Coin Change

Dynamic Programming - 322. Coin Change

Coin Change You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Example 1: Input: coins = [1, 2, 5], amount = 11 Output: 3 Explanation: 11 = 5 + 5 + 1 Example 2: Input: coins = [2], amount = 3 Output: -1 Note: You may assume that you have an infinite number of each kind of coin. 思路: ....

Array - 48. Rotate Image

Array - 48. Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise).

73. Set Matrix Zeroes

73. Set Matrix Zeroes

Given an m x n matrix. If an element is 0, set its entire row and column to 0. Do it in-place.

Array - 56. Merge Intervals

Array - 56. Merge Intervals

Given a collection of intervals, merge all overlapping intervals.

LinkedList - 23. Merge k Sorted Lists

LinkedList - 23. Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

重排奇偶有序链表

重排奇偶有序链表

给定一个链表,其中奇数位是升序的,偶数位是降序的,实现链表的排序。

LinkedList - 21. Merge Two Sorted Lists

LinkedList - 21. Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.

LinkedList - 328. Odd Even Linked List

LinkedList - 328. Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.

LinkedList - 206. Reverse Linked List

LinkedList - 206. Reverse Linked List

Reverse a singly linked list.

LinkedList - 92. Reverse Linked List II

LinkedList - 92. Reverse Linked List II

Reverse Linked List II Reverse a linked list from position m to n. Do it in one-pass. **Note: **1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5->NULL 思路: 找到m的前一位,然后翻转n-m+1个节点,链表翻转类型的题目常规套路都是使用一个dummy来保存head链表头。因为题目说了链表长度比m和n都要大,所以不用额外关注m和n会不会导致空指针。 代码: java: /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { publ....

接口实现幂等的几种方式

接口实现幂等的几种方式

最近处理的单据业务经常会因为接口不幂等导致数据出错的情况。所以幂等性在设计系统的时候一定要考虑进去,尤其是像支付宝、银行、互联网金融公司等涉及的都是钱的系统,既要高效,也要准确,所以不能出现多扣款、多打款等问题,不然这样会很难处理,用户体验也不会好。

Nothing just happens, it's all part of a plan.