摘要:
①:暴力法 public class Solution { public int MaxProfit(int[] prices) { int finalProfit = 0; for (int i = 0; i < prices.Length-1; i++) { for (int j = i; j 阅读全文
摘要:
①:dp动态规划 public class Solution { public int LengthOfLIS(int[] nums) { int[] dp = new int[nums.Length]; for (int i = 0; i < nums.Length; i++) { dp[i] = 阅读全文
摘要:
①:Hash(字典) public static int[] Intersect(int[] nums1, int[] nums2) { var dict = new Dictionary<int, int>(); //数组1置为小数组,数组2置为大数组 if (nums1.Length > num 阅读全文
摘要:
①: public void Merge(int[] nums1, int m, int[] nums2, int n) { int size = m + n; for (int i = 0; i < nums2.Length; i++) { if (m < size) { nums1[m++] = 阅读全文
摘要:
①:两次遍历 时间复杂度为O(n平方) public int[] TwoSum(int[] nums, int target) { for (int i = 0; i < nums.Length; i++) { for (int j = i+1; j < nums.Length; j++) { if 阅读全文
摘要:
①:动态规划 url:经典动态规划问题(理解「无后效性」) - 最大子序和 - 力扣(LeetCode) (leetcode-cn.com)(从零开始剖析入门动态规划) public class Solution { public int MaxSubArray(int[] nums) { for 阅读全文
摘要:
①:用字典存储(内存消耗大) public class Solution { public bool ContainsDuplicate(int[] nums) { var dict = new Dictionary<int, int>(); for (int i = 0; i < nums.Len 阅读全文
摘要:
-- 匹配超链接 function M.HyperTextFormat(content) local content = 'https://cn.bing.com/search?q=%E5%A5%87%E8%91%A9%E7%9A%84%E5%9F%9F%E5%90%8D&form=ANNTH1&r 阅读全文
摘要:
Array = {row=0,col=0} Chess={ipos=0,jpos=0,chessturn=0} local array={} local isWin=false local isWhite=false local isBlack=true print("五子棋游戏开始:请输入你需要的 阅读全文