花狗

导航

 

2021年9月28日

摘要: 回溯 括号生成 数字 `n` 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 **有效的** 括号组合。 输入:n = 3输出:["((()))","(()())","(())()","()(())","()()()"] class Solution { void backtrac 阅读全文
posted @ 2021-09-28 22:09 花狗 阅读(26) 评论(0) 推荐(0)
 

2021年9月25日

摘要: c++设计模式 隔离变化 各司其职 对象是什么: 从语言实现层面上看: 对象封装了代码和数据接口; 从规格层面讲,对象是一系列可被使用的公共接口。 从概念层面讲,对象是某种拥有责任的抽象 设计原则 1.依赖倒置原则(DIP) 高层模块(稳定)不应该依赖与底层模块(变化),二者都应该依赖于抽象(稳定) 阅读全文
posted @ 2021-09-25 20:47 花狗 阅读(31) 评论(0) 推荐(0)
 

2021年9月15日

摘要: |proto|C++|备注 | double | double | 64位浮点数 || float | float | 32位浮点数 || int32 | int32 | 32位整数 || int64 | int64 | 64位整数 || uint32 | uint32 | 32位无符号整数 || 阅读全文
posted @ 2021-09-15 09:44 花狗 阅读(363) 评论(0) 推荐(0)
 

2021年9月7日

摘要: https://blog.csdn.net/shengyu21/article/details/8088119 阅读全文
posted @ 2021-09-07 09:22 花狗 阅读(26) 评论(0) 推荐(0)
 

2021年9月6日

摘要: 问题:查找所有元素后面第一个比他大的数 思路:用栈的方式将每个元素的位置下表存储起来,每次入栈的元素和当前栈顶代表的元素进行比较,如果大于栈顶元素则将其两个位置进行相减得到右边最近的大于自身的元素距离,如不大于栈顶元素则入栈; vector<int> findMax(vector<int> num) 阅读全文
posted @ 2021-09-06 16:57 花狗 阅读(239) 评论(0) 推荐(0)
 

2021年9月4日

摘要: 阅读全文
posted @ 2021-09-04 16:32 花狗 阅读(29) 评论(0) 推荐(0)
 

2021年9月3日

摘要: int longestValidParentheses(string s) { int l = 0, r = 0, ans = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == '(')l++; else r++; if (r > l)l = 阅读全文
posted @ 2021-09-03 22:29 花狗 阅读(37) 评论(0) 推荐(0)
 

2021年9月2日

摘要: #include <iostream> using namespace std; int main() { int day = 0; // 日期 int month = 0; // 月份 int year = 0; // 年份 int sum = 0; // 一年中的第几天 cin >> year 阅读全文
posted @ 2021-09-02 20:19 花狗 阅读(107) 评论(0) 推荐(0)
 
摘要: int main() { int t, a, b; cin >> t; vector<vector<int>> m; for (int i = 1; i < t; ++i) { vector<int> m1; cin >> a >> b; m1.push_back(a); m1.push_back( 阅读全文
posted @ 2021-09-02 11:36 花狗 阅读(33) 评论(0) 推荐(0)
 

2021年9月1日

摘要: 图: 1.传递信息 给定总玩家数 n,以及按 [玩家编号,对应可传递玩家编号] 关系组成的二维数组 relation。返回信息从小 A (编号 0 ) 经过 k 轮传递到编号为 n-1 的小伙伴处的方案数;若不能到达,返回 0。 链接:https://leetcode-cn.com/problems 阅读全文
posted @ 2021-09-01 20:20 花狗 阅读(65) 评论(0) 推荐(0)