02 2019 档案
摘要:题目 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), ne...
阅读全文
摘要:题目 代码/*// Definition for a Node.class Node {public: int val; Node* next; Node* random; Node() {} Node(int _val, Node* _next...
阅读全文
摘要:题目 https://leetcode-cn.com/explore/learn/card/linked-list/197/conclusion/764/代码 /*// Definition for a Node.class Node {public: int val;...
阅读全文
摘要:[System.Obsolete("这是一条提示信息,表示这个方法弃用了,使用此方法会有一条Warning信息")]private void SaveDataMessage(SaveMessage message){}在方法上方添加特性,即可,如果想要不允许通过编译,则需要在...
阅读全文
摘要:题目设计链表的实现。您可以选择使用单链表或双链表。单链表中的节点应该具有两个属性:val 和 next。val 是当前节点的值,next 是指向下一个节点的指针/引用。如果要使用双向链表,则还需要一个属性 prev 以指示链表中的上一个节点。假设链表中的所有节点都是 0-in...
阅读全文
摘要:题目 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), ne...
阅读全文
摘要:题目 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), ne...
阅读全文
摘要:题目 代码 typedef struct SingleList {public: int val; SingleList* next; };class MyLinkedList {public: /** Initialize your data struc...
阅读全文
摘要:题目 代码class MinStack {public: /** initialize your data structure here. */ MinStack():nums(),sorted() { } void p...
阅读全文
摘要:题目 代码 class Solution {public: int numSquares(int n) { vector dp(n + 1, INT_MAX); dp[0] = 0; for (int i = 0; i <=...
阅读全文
摘要:题目 代码class MyCircularQueue {public: /** Initialize your data structure here. Set the size of the queue to be k. */ MyCircularQueue(...
阅读全文
摘要:题目 代码class Solution {public: string reverseWords(string s) { for(int i=0,j=0;j<=s.size();j++) { if(j==s.size()...
阅读全文
摘要:题目 代码 class Solution {public: void reverseWords(string &s) { if (s.empty()) return; //-----判断是否不包含单词,全是空格 bool isSpace = ...
阅读全文
摘要:题目 代码 class Solution {public: vector getRow(int rowIndex) { vector array(rowIndex+1); for(int i=0;i 0; j--){ ...
阅读全文
摘要:题目 代码 class Solution {public: int minSubArrayLen(int s, vector& nums) { if(nums.empty()) return 0; int start=0,e...
阅读全文
摘要:题目 代码 class Solution {public: int findMaxConsecutiveOnes(vector& nums) { int length=0; int maxLength=0; for(int i=...
阅读全文
摘要:题目 代码 class Solution {public: int removeElement(vector& nums, int val) { int i = 0, j = 0; while(j != nums.size()) ...
阅读全文
摘要:题目 代码 class Solution {public: vector twoSum(vector& numbers, int target) { int start=0,end=numbers.size()-1; vector resul...
阅读全文
摘要:题目 代码 class Solution {public: int arrayPairSum(vector& nums) { std::sort(nums.begin(),nums.end()); int result=0; f...
阅读全文
摘要:题目 代码class Solution {public: string addBinary(string a, string b) { int lenA = a.length(); int lenB = b.length(); string result; int a...
阅读全文
摘要:题目 代码class Solution {public: vector findDiagonalOrder(vector>& matrix) { //判断是否为空 if(matrix.empty()) return {}; ...
阅读全文
摘要:题目 代码 class Solution {public: vector spiralOrder(vector>& matrix) { if (matrix.empty() || matrix[0].empty()) return {}; i...
阅读全文
摘要:题目 代码class Solution {public: int dominantIndex(vector& nums) { vector sortedNums=nums; std::sort(sortedNums.begin(),sort...
阅读全文
摘要:效果 点击选择皮肤颜色 代码 public enum Themes { Blue, Gray, Orange } /// /// 主题颜色管理类 /// public static class ...
阅读全文
摘要:有可能的原因如下:绑定的属性一定是属性而不能是字段,比如:public int data;是无法生效的,而public int data {get;set;}这样才能生效
阅读全文