- 博客(25)
- 资源 (4)
- 收藏
- 关注
原创 [Leetcode]旋转链表
题目 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:...
2019-02-26 17:04:36 228
原创 [LeetCode]复制带随机指针的链表
题目 代码/*// Definition for a Node.class Node {public: int val; Node* next; Node* random; Node() {} Node(int _val, Node* _next, Node* _random) { val = _val; ...
2019-02-26 16:19:39 199
原创 [Leetcode]扁平化多级双向链表
题目 https://leetcode-cn.com/explore/learn/card/linked-list/197/conclusion/764/代码 /*// Definition for a Node.class Node {public: int val; Node* prev; Node* next; Node* ch...
2019-02-26 15:53:49 342
原创 [WPF]将方法设为弃用
[System.Obsolete("这是一条提示信息,表示这个方法弃用了,使用此方法会有一条Warning信息")]private void SaveDataMessage(SaveMessage message){}在方法上方添加特性,即可,如果想要不允许通过编译,则需要在后方再加一个参数true。...
2019-02-25 22:11:52 398
原创 [Leetcode]设计链表
题目设计链表的实现。您可以选择使用单链表或双链表。单链表中的节点应该具有两个属性:val 和 next。val 是当前节点的值,next 是指向下一个节点的指针/引用。如果要使用双向链表,则还需要一个属性 prev 以指示链表中的上一个节点。假设链表中的所有节点都是 0-index 的。在链表类中实现这些功能:get(index):获取链表中第 index 个节点的值。如果索引无效...
2019-02-25 20:03:42 719 1
原创 [Leetcode]移除链表元素
题目 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:...
2019-02-25 19:36:28 123
原创 [Leetcode]环形链表 II
题目 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:...
2019-02-24 16:06:40 79
原创 [Leetcode]设计链表
题目 代码 typedef struct SingleList {public: int val; SingleList* next; };class MyLinkedList {public: /** Initialize your data structure here. */ MyLinkedList():_head(new ...
2019-02-24 15:28:35 184
原创 [Leetcode]最小栈
题目 代码class MinStack {public: /** initialize your data structure here. */ MinStack():nums(),sorted() { } void push(int x) { sorted[x]++; ...
2019-02-23 22:07:39 185
原创 [Leetcode]完全平方数
题目 代码 class Solution {public: int numSquares(int n) { vector<int> dp(n + 1, INT_MAX); dp[0] = 0; for (int i = 0; i <= n; ++i) { ...
2019-02-23 18:49:47 399
原创 [Leetcode]设计循环队列
题目 代码class MyCircularQueue {public: /** Initialize your data structure here. Set the size of the queue to be k. */ MyCircularQueue(int k):array(k),pre(0),rail(0),numbers(0) { ...
2019-02-23 15:53:10 296
原创 [Leetcode]反转字符串中的单词 III
题目 代码class Solution {public: string reverseWords(string s) { for(int i=0,j=0;j<=s.size();j++) { if(j==s.size()||s[j]==' ') { ...
2019-02-23 12:09:29 273
原创 [LeetCode]翻转字符串里的单词
题目 代码 class Solution {public: void reverseWords(string &s) { if (s.empty()) return; //-----判断是否不包含单词,全是空格 bool isSpace = true; for (auto i : s) { if (i != ...
2019-02-23 12:06:34 539
原创 [LeetCode]杨辉三角 II
题目 代码 class Solution {public: vector<int> getRow(int rowIndex) { vector<int> array(rowIndex+1); for(int i=0;i<=rowIndex;i++){ for (int j = i - ...
2019-02-23 10:23:54 250
原创 [LeetCode]长度最小的子数组
题目 代码 class Solution {public: int minSubArrayLen(int s, vector<int>& nums) { if(nums.empty()) return 0; int start=0,end=0,size=nums.size(),sum=nums...
2019-02-23 09:57:07 175
原创 [LeetCode]最大连续1的个数
题目 代码 class Solution {public: int findMaxConsecutiveOnes(vector<int>& nums) { int length=0; int maxLength=0; for(int i=0;i<nums.size();i++) ...
2019-02-23 09:14:03 317
原创 [LeetCode]移除元素
题目 代码 class Solution {public: int removeElement(vector<int>& nums, int val) { int i = 0, j = 0; while(j != nums.size()) { if(n...
2019-02-22 17:07:50 117
原创 [LeetCode]两数之和 II - 输入有序数组
题目 代码 class Solution {public: vector<int> twoSum(vector<int>& numbers, int target) { int start=0,end=numbers.size()-1; vector<int> result; ...
2019-02-22 15:25:53 261
原创 [LeetCode]数组拆分 I
题目 代码 class Solution {public: int arrayPairSum(vector<int>& nums) { std::sort(nums.begin(),nums.end()); int result=0; for(int i=0;i<nums.size();i+=...
2019-02-22 15:09:32 782 1
原创 [LeetCode]二进制求和
题目 代码class Solution {public: string addBinary(string a, string b) { int lenA = a.length(); int lenB = b.length(); string result; int addFlag = 0; int i; int current = 0; fo...
2019-02-22 12:25:38 223
原创 [LeetCode]对角线遍历
题目 代码class Solution {public: vector<int> findDiagonalOrder(vector<vector<int>>& matrix) { //判断是否为空 if(matrix.empty()) return {}; ...
2019-02-10 23:29:09 580
原创 [LeetCode]螺旋矩阵
题目 代码 class Solution {public: vector<int> spiralOrder(vector<vector<int>>& matrix) { if (matrix.empty() || matrix[0].empty()) return {}; int heigh...
2019-02-10 22:49:53 9334
原创 [LeetCode]至少是其他数字两倍的最大数
题目 代码class Solution {public: int dominantIndex(vector<int>& nums) { vector<int> sortedNums=nums; std::sort(sortedNums.begin(),sortedNums.end()); ...
2019-02-10 21:47:58 325
原创 [WPF]颜色主题功能
效果 点击选择皮肤颜色 代码 public enum Themes { Blue, Gray, Orange } /// <summary> /// 主题颜色管理类 /// </summary> public static class The...
2019-02-06 20:57:35 2110 3
原创 [WPF]数据绑定失效的问题
有可能的原因如下:绑定的属性一定是属性而不能是字段,比如:public int data;是无法生效的,而public int data {get;set;}这样才能生效
2019-02-04 22:30:17 1095
C#基于TCPIP的聊天室
2017-12-06
Git-2.14.1-64.bit.exe
2017-09-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人