力扣
Yokaihon
这个作者很懒,什么都没留下…
展开
-
LeetCode_寻找两个正序数组的中位数_难度:困难_C#
public class Solution { public double FindMedianSortedArrays(int[] nums1, int[] nums2) { double result = 0; List<double> ltResult = new List<double>(); foreach (var item in nums1) {原创 2021-10-02 21:35:11 · 106 阅读 · 0 评论 -
LeetCode_无重复字符的最长子串_C#
C# unity游戏开发 遍历字符串,倘若不在队列中则将其压入队列,并判断当前个数是不是最大,在队列中则不断弹出头节点直到没有重复代码public class Solution { public int LengthOfLongestSubstring(string s) { Queue a = new Queue(); int result = 0; foreach (var item in s)原创 2021-10-01 20:11:36 · 115 阅读 · 0 评论 -
LeetCode_搜索插入位置
网络上C#的很少 我来用C# 好让unity新手玩家能参考学习public class Solution { public int SearchInsert(int[] nums, int target) { int i = 0; for (i = 0; i < nums.Length; i++) { if (nums[i] == target) r原创 2021-09-27 20:54:02 · 47 阅读 · 0 评论 -
LeetCode_两两交换链表中的节点_C#_迭代
/** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int val=0, ListNode next=null) { * this.val = val; * this.next = next; * } * } */publi原创 2021-09-26 22:55:11 · 78 阅读 · 0 评论 -
LeetCode_22_生成括号_C#
public class Solution { public IList<string> GenerateParenthesis(int n) { List<string> temp = new List<string>(); string s = ""; IsOK(temp, n*2, 0, s); return temp;原创 2021-09-23 20:40:23 · 69 阅读 · 0 评论 -
力扣_合并两个有序链表_迭代_C++
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next)原创 2021-08-31 20:27:34 · 82 阅读 · 0 评论 -
力扣_合并两个有序链表_C#_递归
将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。示例 1:输入:l1 = [1,2,4], l2 = [1,3,4]输出:[1,1,2,3,4,4]来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/merge-two-sorted-lists著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。/** * Definition for singly-linked list. *原创 2021-08-31 20:24:58 · 83 阅读 · 0 评论 -
力扣_两数之和_c#_暴力算法(完成_哈希表法(未完成
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。你可以按任意顺序返回答案。来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/two-sum著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。//暴力算法public class Solution {原创 2021-08-24 21:16:10 · 84 阅读 · 0 评论