trivial practice
rsy56640
学生
展开
-
8queen(稍后补)
等有空了研究一下置换群 感觉可以直接给出序列表示 下面是暴力#include <iostream>#include <iterator>using namespace std;ostream_iterator<int> _oit(cout, " ");int _count = 0;bool judge(int* p, int pos, int m) { for (int i = 0原创 2017-11-09 21:29:02 · 274 阅读 · 0 评论 -
LintCode 12. 带最小值操作的栈
题目链接:https://leetcode.com/problems/longest-valid-parentheses/description/ 要考试了,做点水题保平安()class Solution {public: int longestValidParentheses(string s) { int size = s.size(); stack<原创 2017-12-29 00:00:53 · 261 阅读 · 0 评论 -
LeetCode 692. Top K Frequent Words
题目链接:https://leetcode.com/problems/top-k-frequent-words/description/template&amp;lt;class _Ty1, class _Ty2&amp;gt;struct MyPairLess{ typedef _Ty1 first_argument_type; typedef _Ty2 second_argumen...原创 2017-12-23 13:00:59 · 563 阅读 · 0 评论 -
LeetCode 273. Integer to English Words
这我也是醉了map<int, string>mp[3];map<int, string>mmp;class Solution {private: void add(string& s, int& num) { int x[3]; for (int i = 0; i < 3; ++i) { x[i] = num % 10;原创 2017-12-22 22:33:55 · 158 阅读 · 0 评论 -
LeetCode 452 Minimum Number of Arrows to Burst Balloons
题目链接:https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description/注:下面给的这个不能AC,因为有一组数据是INT_MIN。。把第一个人工记录就好了。贴这个是因为风格比较标准。(略微改了一下,现在可以AC)class Solution {public: int findMinArr...原创 2018-02-20 12:06:26 · 162 阅读 · 0 评论 -
LintCode 207. 区间求和 II
题目链接:http://www.lintcode.com/zh-cn/problem/interval-sum-ii/#class Solution { class SegmentTreeNode { public: int start, end, sum; SegmentTreeNode *left, *right; SegmentTreeNode(int start, int...原创 2018-02-21 11:30:27 · 257 阅读 · 0 评论 -
普通线段树模板(做题用)
https://github.com/rsy56640/rsy_little_lib/tree/master/library_for_algorithm/SegmentTree指针实现class SegmentTree { class SegmentTreeNode { public: int start, end, val; Segm...原创 2018-02-23 21:36:05 · 201 阅读 · 0 评论 -
LeetCode 84. Largest Rectangle in Histogram
题目链接:https://leetcode.com/problems/largest-rectangle-in-histogram/description/https://www.youtube.com/watch?v=VNbkzsnllsU&t=369sclass Solution {public: int largestRectangleArea(vector<int>...原创 2018-02-25 14:09:00 · 113 阅读 · 0 评论 -
LeetCode Weekly Contest 84
行策课没事干,和晨哥窜通一下,打打周赛暖暖手。感觉好久都没写代码了。。832 Flipping an Image 题目链接: https://leetcode.com/contest/weekly-contest-84/problems/flipping-an-image/class Solution {public: vector<vector<int>&...原创 2018-05-13 21:03:28 · 198 阅读 · 1 评论 -
测试
题目链接:https://leetcode.com/problems/top-k-frequent-words/description/templatestruct MyPairLess { typedef _Ty1 first_argument_type; typedef _Ty2 second_argument_type; typedef bool result_type; cons原创 2017-12-29 13:54:27 · 195 阅读 · 0 评论 -
LeetCode 378. Kth Smallest Element in a Sorted Matrix
题目链接:https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/description/struct point { int ary, col; explicit point(int x, int y) :ary(x), col(y) {} point operator++(int) {原创 2018-01-12 22:29:42 · 159 阅读 · 0 评论 -
LeetCode 103. Binary Tree Zigzag Level Order Traversal
题目链接:https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/description/ 明天考试,水一水。。。。。。。。。题目大意:交替方向层次遍历一棵树struct TreeNode { int val; TreeNode *left; TreeNode *right; Tr原创 2018-01-12 16:36:15 · 167 阅读 · 0 评论 -
LeetCode 92. Reverse Linked List II
数学归纳法: 要反转部分的前一个当头,第一个当尾struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {}};class Solution {public: ListNode* reverseBetween(ListNode* head, int m, in原创 2017-12-03 19:14:27 · 212 阅读 · 1 评论 -
LeetCode 477. Total Hamming Distance
不知道说啥。。。。。 算是矮子里面拔将军吧。。。。 不过也就是初中思维()class Solution {public: int totalHammingDistance(vector<int>& nums) { int total = 0; int size = nums.size(); for (int bit = 0; bit <原创 2017-12-03 19:20:42 · 252 阅读 · 1 评论 -
LeetCode 714. Best Time to Buy and Sell Stock with Transaction Fee
题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/ DP还没入门吧,过一段时间再来嘲笑现在的水平(逃class Solution {public: int maxProfit(vector<int>& prices, int fee) {原创 2017-12-06 22:42:38 · 196 阅读 · 0 评论 -
LeetCode 45. Jump Game II
简单贪心:用RiR_i标记第ii步能到达的最右边位置.首先,Ri−1+1R_{i-1}+1到RiR_i都属于第i步可到达的位置. 事实上假设RiR_i上一步是xx,则xx属于第i−1i-1步可以到达的位置. 那么x≤Ri−1x\le R_{i-1},并且xx可以到达x+1x+1到RiR_i, 故第ii步可以到达Ri−1+1R_{i-1}+1到RiR_i.其次,我们说Ri+1R_{i+1}可以由原创 2017-12-04 23:22:00 · 222 阅读 · 0 评论 -
LeetCode 460. LFU Cache
题目链接:https://leetcode.com/problems/lfu-cache/description/这里写代码片原创 2017-12-16 18:49:26 · 320 阅读 · 0 评论 -
LeetCode 146. LRU Cache
题目链接:https://leetcode.com/problems/lru-cache/discuss/ 非原创,来源于http://blog.csdn.net/qq508618087/article/details/50995188class LRUCache {public: LRUCache(int _capacity) :capacity(_capacity) {} i转载 2017-12-16 18:47:35 · 173 阅读 · 0 评论 -
LintCode 125. 背包问题 II
题目链接:http://www.lintcode.com/zh-cn/problem/backpack-ii/ 2017.12.25 无事,水class Solution {public: /* * @param m: An integer m denotes the size of a backpack * @param A: Given n items with s原创 2017-12-25 20:41:03 · 242 阅读 · 0 评论 -
在VS中配置MASM
视频教程:MASM 在 VS 中的使用代码示例:https://pastebin.com/R4WJwfn0无法运行请参考:https://stackoverflow.com/a/4549741/8489782寄存器视图:调试->窗口->寄存器...原创 2018-10-12 17:31:57 · 2384 阅读 · 2 评论