Shilei Tian

Waiting Persistent Accumulation Surpass

[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 o..

[LeetCode 239] Sliding Window Maximum

题目要求Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the..

[LeetCode 142] Linked List Cycle II

题目要求Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:C..

[LeetCode 16] 3Sum Closest

题目要求Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three int..

[C++] 在 C++ 中计算对象个数

本文为阅读 Scott Meyers 在 1998 年 4 月发表在《C++ User’s Journal》上的文章《Objects Counting in C++》读书笔记,旨在更好地理解 C++ 相关的概念。 问题我们现在想要设计一个 Widget 类,希望它有一个功能,是能够找到程序执行期..

[LeetCode 309] Best Time to Buy and Sell Stock with Cooldown

题目描述Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may ..

[LeetCode 3] Longest Substring Without Repeating Characters

题目要求Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "..

[Glibc 源码分析] 1. 深度解析 memmove 函数

上次去某公司面试,被问到如何实现一个 strncpy 函数,并且还被问到要考虑哪些特殊情况。面试结束后回来上网查询了一下库函数是如何实现的,顿时被库函数那些简洁高效的实现方式吸引,所以打算将研读一些经典函数的实现。标准库函数的实现参考的是 glibc 的实现。 第一篇文章就从底层内存操作开始讲起..

[LeetCode 41] First Missing Positive

题目要求Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2. Your algor..

[LeetCode 523] Continuous Subarray Sum

题目要求Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2..