摘要: ##固定窗口 int numOfSubarrays(int* arr, int arrSize, int k, int threshold) { int sum = 0, ret = 0; threshold *= k; for(int i = 0; i < k; ++i) { sum += arr 阅读全文
posted @ 2022-05-06 14:33 越菜越自信 阅读(28) 评论(0) 推荐(0)
摘要: ##Problem Description Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. class MinStack { public: //Cre 阅读全文
posted @ 2022-03-27 17:03 越菜越自信 阅读(17) 评论(0) 推荐(0)
摘要: 题目描述: 这题表述的很明确了,从最末尾的元素开始输出,这让我们想到的数据结构就是栈了。 思路:先把链表中存储的数据压入栈中,然后弹出到一个动态数组vector中,最后返回数组。 /** * Definition for singly-linked list. * struct ListNode { 阅读全文
posted @ 2022-03-27 10:44 越菜越自信 阅读(20) 评论(0) 推荐(0)
摘要: ##vector is a dynamic array When we want to use vector,we should write this #include We can add and delete element at the tail of vector by using func 阅读全文
posted @ 2022-03-27 00:30 越菜越自信 阅读(23) 评论(0) 推荐(0)
摘要: This problem let us remove linked list elements. Problem description: Given the head of a linked list and an integer val, remove all the nodes of the 阅读全文
posted @ 2022-03-25 21:10 越菜越自信 阅读(23) 评论(0) 推荐(0)
摘要: This problem let us reverse linked list. Problem description: Given the head of a singly linked list, reverse the list, and return the reversed list. 阅读全文
posted @ 2022-03-25 16:13 越菜越自信 阅读(21) 评论(0) 推荐(0)
摘要: ![](https://img2022.cnblogs.com/blog/2540508/202202/2540508-20220215002114646-1343166464.png) ![](https://img2022.cnblogs.com/blog/2540508/202202/2540508-20220215002138248-593292285.png) ![](https://i 阅读全文
posted @ 2022-02-15 00:23 越菜越自信 阅读(29) 评论(0) 推荐(0)
摘要: & 运算符的应用 1)奇偶判定 通常判定偶数的方法是用 %(mod) number % 2 == 0 但是我们可以用位与 & 来判定 number & 1 == 0 2)取末五位 3)消除末五位 4)2的幂 判定 除了妙 我还能说什么?! | 运算符的应用 #include <stdio.h> in 阅读全文
posted @ 2022-02-09 23:51 越菜越自信 阅读(437) 评论(0) 推荐(0)
摘要: ##搬运 阅读全文
posted @ 2022-02-08 23:24 越菜越自信 阅读(41) 评论(0) 推荐(0)
摘要: 最近又发现了几位大佬... 关于每天坚持健身,彭于晏也讲过类似的话。 分而治之! 阅读全文
posted @ 2022-02-07 15:03 越菜越自信 阅读(97) 评论(0) 推荐(0)