上一页 1 2 3 4 5 6 7 ··· 24 下一页
摘要: 题目链接 https://codeforces.com/problemset/problem/1654/C 切蛋糕,判断数组是否为合法的切割中间状态 #include<bits/stdc++.h> using namespace std; typedef long long ll; bool ok( 阅读全文
posted @ 2022-03-22 00:03 墨鳌 阅读(106) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int bestRotation(vector<int>& A) { int N = A.size(); vector<int> mark(N, 0); for (int i = 0; i < N; ++i) { int L = (i + 1) % 阅读全文
posted @ 2022-03-09 09:48 墨鳌 阅读(21) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: bool isMatch(string s, string p) { int m = s.size(); int n = p.size(); auto matches = [&](int i, int j) { if (i == 0) { retur 阅读全文
posted @ 2022-03-09 09:22 墨鳌 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 组合数学 \(O(N\cdot M)\) class Solution { public: int f[10][10]; int C(int n, int m) { if (n == m || m == 0) return 1; return f[n][m] = C(n - 1, m - 1) + 阅读全文
posted @ 2022-03-08 22:26 墨鳌 阅读(42) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: bool isSubsequence(string s, string t) { int n = s.length(), m = t.length(); int i = 0, j = 0; while (i < n && j < m) { if (s 阅读全文
posted @ 2022-03-08 19:42 墨鳌 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 解题思路 精彩 O(1) class Solution { public: bool isPalindrome(ListNode* head) { if (head == nullptr) { return true; } ListNode* firstHalfEnd = endOfFirstHal 阅读全文
posted @ 2022-03-08 19:26 墨鳌 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 微软一面 - 2022.3.7 GG 自我介绍 我有点草率,就单一点讲太多了,也没有跟面试官互动 大概几分钟吧,面试官也比较干脆,于是说,那就上题目? 然后就开始写题了…… 三门问题 面试官本意是想让我写随机模拟 哪知道我直接用古典概型给他求精确概率,应该给他整无语了 个人感觉应该很扣分吧,没有 g 阅读全文
posted @ 2022-03-08 16:09 墨鳌 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题目链接 题解链接 解题思路 简单 01 枚举 位运算基础操作 class Solution { private: bool isValid(string s) { int count = 0; for (char &c: s) { if (c == '(')count++; else count- 阅读全文
posted @ 2022-02-26 17:26 墨鳌 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 题目链接 题解链接 解题思路 引入神经网络概念: 激活函数之一:ReLU(x) \(ReLU(x)=\begin{cases}0\ (x\leq0)\\x\ (x>0)\end{cases}\iff ReLU(x)=\max(x,0)\) 假设状态 \(dp(i)\) 为: 当前 \(i\) 个元素 阅读全文
posted @ 2022-02-17 14:07 墨鳌 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 题目链接 题解链接 解题思路 卡特兰数 代码 // 1 2 5 14 卡特兰数从第二项开始 class Solution { public: unordered_map<int,int>C; int Catalan(int n,int mod){ if(n<=1)return C[n]=1; if( 阅读全文
posted @ 2022-02-16 18:55 墨鳌 阅读(23) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 24 下一页