1 吃石榴的柚子

尚未进行身份认证

我要认证

暂无相关简介

等级
TA的排名 22w+

队列239、滑动窗口的最大值

题目C#代码public class Solution { public int[] MaxSlidingWindow(int[] nums, int k) { MyCircularDeque deque=new MyCircularDeque(k); int[] result = new int[nums.Length-k+1]; int j = 0; for (i

2020-07-01 11:26:03

图210、课程表Ⅱ

题目C#代码public class Solution { public int[] FindOrder(int numCourses, int[][] prerequisites) { int[] res = new int[numCourses]; LinkedList<int>[] list = new LinkedList<int>[numCourses]; for (int i = 0;

2020-07-01 11:16:36

图207、课程表

题目C#代码public class Solution { public bool CanFinish(int numCourses, int[][] prerequisites) { LinkedList<int>[] list = new LinkedList<int>[numCourses]; for (int i = 0; i < list.Length; i++) {

2020-07-01 11:08:51

二叉树236、二叉树的最近公共祖先

题目C#代码/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */public class Solution { public TreeNode

2020-07-01 10:56:23

二叉树104、二叉树的最大深度

题目C#代码/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */public class Solution { public int MaxDe

2020-07-01 00:40:08

二叉树101、对称二叉树

题目C#代码/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */public class Solution { public bool IsSy

2020-07-01 00:34:50

二叉树100、相同的树

题目C#代码/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */public class Solution { public bool IsSa

2020-06-30 23:53:16

位运算89、格雷编码

题目C#代码(不会不会)public class Solution{public IList<int> GrayCode(int n){ IList<int> list = new List<int> { 0 }; int len; for (int i = 0; i < n; i++) { len = list.Count;//记录之前元素数量 for (int j = len - 1; j

2020-06-30 23:26:59

位运算78、子集

题目C#代码(其实没太懂)public class Solution { public IList<IList<int>> Subsets(int[] nums) { int all_set = 1 << nums.Length; IList<IList<int>> result = new List<IList<int>>();

2020-06-30 16:58:43

字符串344、反转字符串

题目C#代码public class Solution { public void ReverseString(char[] s) { int i=0; int j=s.Length-1; char temp; while(i<j) { temp=s[i]; s[i]=s[j]; s[j]=temp; i++;

2020-06-30 11:10:35

字符串14、最长公共前缀

题目C#代码public class Solution { public string LongestCommonPrefix(string[] strs) { if (strs.Length == 0) { return ""; } string result = ""; for (int i = 0; i < strs[0].Length;

2020-06-30 00:55:50

队列641、设计循环双端队列

题目C#代码(老马老师)public class MyCircularDeque { private int pfront; private int prear; private readonly int[] dataset; private int length; private int maxsize; /** Initialize your data structure here. Set the size of the deque to be

2020-06-29 23:44:47

队列7、整数反转

题目C#代码(老马老师)public class Solution { public int Reverse(int x) { if(x==int.MinValue) return 0; long result=0; int flag=x>0?1:-1; x=flag*x; Queue<int> q=new Queue<int>(); while(x!=

2020-06-29 23:06:24

栈155、最小栈

题目C#代码public class MinStack { /** initialize your data structure here. */ private Stack<int> myStack; public MinStack() { myStack = new Stack<int>(); } public void Push(int x) {

2020-06-29 21:31:03

栈150、逆波兰表达式

题目C#代码1public class Solution { public int EvalRPN(string[] tokens) { Stack<int> s = new Stack<int>(); int i = 0; while(i<tokens.Length) { int tmp = 0; if(int.TryPar

2020-06-29 21:28:32

数据结构与算法——8-1 No.3无重复字符的最长子串

题目要求C++代码class Solution {public: int lengthOfLongestSubstring(string s) { int res=0,len=0,v[200]; memset(v,0,sizeof(v)); for(int i=0;i<s.length();i++) { ...

2020-04-11 22:39:44

数据结构与算法——8-2 136题只出现一次的数字

题目要求解题思路刚开始想再定义一个数组,存储不同的数字出现的次数,后来发现不太容易。然后查找了一下资料,发现有sort函数可以直接给数组排序,然后运用一个for循环,找出只出现一次的数字。C++代码class Solution {public: int singleNumber(vector<int>& nums) { sort(nums.b...

2020-04-09 22:47:03

数据结构与算法——栈13.有效的括号

题目要求C++代码class Solution {public: bool isValid(string s) { stack<char> st; st.push('#'); char c[150]; c['('] = ')'; c['{'] = '}'; c['['] = ...

2020-03-22 20:31:22

数据结构与算法——12.环形链表

题目要求解题思路快慢指针法C++代码/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {...

2020-03-15 15:11:47

数据结构与算法——11.删除排序链表中的重复元素

题目要求C++代码/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ...

2020-03-15 14:56:22

查看更多

勋章 我的勋章
  • 阅读者勋章Lv1
    阅读者勋章Lv1
    授予在CSDN APP累计阅读博文达到3天的你,是你的坚持与努力,使你超越了昨天的自己。
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 1024勋章
    1024勋章
    #1024程序员节#活动勋章,当日发布原创博客即可获得
  • 勤写标兵Lv4
    勤写标兵Lv4
    授予每个自然周发布9篇以上(包括9篇)原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。