- 博客(10)
- 收藏
- 关注
原创 基于std vector的ring buffer的实现。
class CircularBuffer:public boost::noncopyable {public: CircularBuffer() {} explicit CircularBuffer(size_t s) { data_.resize(s); capacity_ = s; } bool closed() const { return closed_; } void open() { LockGuard lock(mutex_);
2021-12-29 15:45:29
836
原创 损失最小的路径
nt get_min_cost_path(vector<vector<int>>& mat) { int rows = mat.size(); int cols = mat[0].size(); vector<int> dp(rows); vector<int> dp_(rows); for (int i = 0; i < rows; i++) dp[i] = mat[i][0]; for (int c_idx = 1; c_id
2021-08-16 22:48:20
123
原创 打家劫舍——四联
标准打架劫色class Solution {public: int rob(vector<int>& nums) { if (nums.size() == 0) return 0; if (nums.size() == 1) return nums[0]; int first = nums[0]; int second = max(nums[1], nums[0])
2021-07-16 01:01:16
105
原创 不同的二叉搜索树
class Solution {public: vector<TreeNode *> backtrace(int b, int e) { vector<TreeNode*> res; if (b>e) { res.push_back(nullptr); return res; } for (int i=b; i <= e; i++) {
2021-07-14 23:05:50
71
原创 字符串匹配dp
https://leetcode-cn.com/problems/regular-expression-matching/submissions/class Solution {public: bool isMatch(string s, string p) { int len_s = s.size(); int len_p = p.size(); vector<vector<bool>> dp(len_s+1);
2021-07-07 00:45:00
162
原创 k个一组反转列表
https://leetcode-cn.com/problems/reverse-nodes-in-k-group//** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {}
2021-07-06 23:08:00
110
原创 旋转图像——48
旋转图像class Solution {public: void swap_(int& a, int& b, int& c, int& d) { if (&a==&b) return; auto tmp = d; d = c; c = b; b = a; a = tmp; } void rotate(vector&
2021-06-09 00:26:06
69
原创 快速排序——quicksort
快速排序#include <iostream>#include <bits/stdc++.h>using namespace std;int partition(vector<int>& nums, int b, int e) { cout<<b<<" "<<e<<endl; int p = b-1; for (int i = b; i < e; i++) { i
2021-06-08 23:45:30
87
原创 矩阵的蛇形打印
矩阵的蛇形打印#include <iostream>#include<bits/stdc++.h>using namespace std;vector<int> print_mat(vector<vector<int>> mat) { vector<int> res; int m = mat.size(); int n = mat[0].size(); int i=0; int j=0; bool reverse =
2021-05-29 17:13:08
156
原创 修复kaldi中的在线语音识别的bug
修复kaldi中的在线语音识别的bug当我们运行kaldi的online目录下的online-gmm-decode-faster的时候程序会显示PortAudio failed to open the default stream错误信息(kaldi的在线识别倚赖于portaudio库,这个库的作用可以理解为操作系统声音模块相关API的一个的封装。提供一个更加友好的编程接口,而且是跨平台的)。在使用
2017-04-01 20:08:22
5398
5
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人