文章 224
评论 6
浏览 172855
Slice - append操作引发的panic

Slice - append操作引发的panic

共享变量的拷贝和append操作线程不安全,导致map被多个协程操作,引发panic。

golang 标准库 time/rate 介绍

golang 标准库 time/rate 介绍

golang官方库中有一个rate包,实现了令牌桶算法。

性能测试工具——wrk

性能测试工具——wrk

wrk 是一款简单的 HTTP 压测工具。

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).

410. 分割数组的最大值

410. 分割数组的最大值

给定一个非负整数数组nums和一个整数m ,你需要将这个数组分成m个非空的连续子数组。 设计一个算法使得这m个子数组各自和的最大值最小。

golang 内存分析/内存泄漏

golang 内存分析/内存泄漏

当golang程序在运行过程中消耗了超出预期内存时,需要搞明白,到底是程序中哪些代码导致了这些内存消耗。此时,通常可以采用golang的pprof来分析golang进程的内存使用。

301. 删除无效的括号

301. 删除无效的括号

给你一个由若干括号和字母组成的字符串 s ,删除最小数量的无效括号,使得输入的字符串有效。 返回所有可能的结果。答案可以按任意顺序返回。

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.

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.

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