上一页 1 2 3 4 5 6 ··· 14 下一页
摘要: 遍历json value #include "json.h" typedef Json::Writer JsonWriter; typedef Json::Reader JsonReader; typedef Json::Value JsonValue; void print(JsonValue v 阅读全文
posted @ 2021-04-27 13:55 米开朗菠萝 阅读(2434) 评论(0) 推荐(0)
摘要: 总结: LT水平触发:有数据一直触发 客户端发送了100个字节,服务端一次性接受5个字节,会一直触发epoll读事件,直到读完了这100个字节 ET:从没有数据到有数据的过程中才触发 客户端发送了100个字节,服务端只接受5个字节,等到下次客户端发送数据的时候,才会触发epoll事件,读取后面的字节 阅读全文
posted @ 2021-04-26 17:04 米开朗菠萝 阅读(91) 评论(0) 推荐(0)
摘要: 解决办法:加上了fflush(stdout); 阅读全文
posted @ 2021-03-10 15:32 米开朗菠萝 阅读(363) 评论(0) 推荐(0)
摘要: Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warme 阅读全文
posted @ 2020-05-06 14:36 米开朗菠萝 阅读(148) 评论(0) 推荐(0)
摘要: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2020-03-31 22:54 米开朗菠萝 阅读(92) 评论(0) 推荐(0)
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2020-03-31 22:17 米开朗菠萝 阅读(138) 评论(0) 推荐(0)
摘要: 一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。 答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。 示例 1: 输入:n = 2输出:2示例 2: 输入:n = 7输出:21提示: 0 <= n 阅读全文
posted @ 2020-03-31 18:48 米开朗菠萝 阅读(259) 评论(0) 推荐(0)
摘要: 写一个函数,输入 n ,求斐波那契(Fibonacci)数列的第 n 项。斐波那契数列的定义如下: F(0) = 0, F(1) = 1F(N) = F(N - 1) + F(N - 2), 其中 N > 1.斐波那契数列由 0 和 1 开始,之后的斐波那契数就是由之前的两数相加而得出。 答案需要取 阅读全文
posted @ 2020-03-31 18:39 米开朗菠萝 阅读(209) 评论(0) 推荐(0)
摘要: 用两个栈实现一个队列。队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead ,分别完成在队列尾部插入整数和在队列头部删除整数的功能。(若队列中没有元素,deleteHead 操作返回 -1 ) 示例 1: 输入:["CQueue","appendTail","delet 阅读全文
posted @ 2020-03-31 18:28 米开朗菠萝 阅读(118) 评论(0) 推荐(0)
摘要: 在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 示例: 现有矩阵 matrix 如下: [ [1, 4, 7, 11, 15], [2, 5, 8, 12, 19] 阅读全文
posted @ 2020-03-31 17:33 米开朗菠萝 阅读(123) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 14 下一页