摘要: 在C#中,可以使用内置的排序方法对数组进行排序。以下是一些常用的排序方法: 使用Array.Sort<T>方法对数组进行排序。这是一个通用方法,可以对任何类型的数组进行排序,只要类型实现了IComparable接口。 int[] array = new int[] { 3, 1, 4, 1, 5, 阅读全文
posted @ 2024-05-03 01:03 yinghualeihenmei 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 原文链接:https://www.cnblogs.com/jk-2048/p/18030587 https://blog.csdn.net/xiongyanglai/article/details/136473932 1、所属命名空间 .NET 3.5在 System.Collections.Gen 阅读全文
posted @ 2024-05-02 23:58 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 我写的: public int VowelStrings(string[] words, int left, int right) { string s="aeiou"; int k=0; for(int i=left;i<=right;i++) { int x=0,y=0; string word 阅读全文
posted @ 2024-05-02 13:49 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 转置让我写成了对角线交换。。。 还是要记录下 对角线交换代码: public int[][] Transpose(int[][] matrix) { int temp=0; int m = matrix.Length, n = matrix[0].Length; for(int i=0;i<m;i+ 阅读全文
posted @ 2024-05-02 13:14 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Math.Max(ans, score) 阅读全文
posted @ 2024-05-01 19:05 yinghualeihenmei 阅读(2) 评论(0) 推荐(0) 编辑
摘要: string str = "Hello, World!"; char character = str[6]; // 取索引为6的字符,结果为'W' Console.WriteLine(character); // 输出: W string s = "011101";s[i] == '0';//i为字 阅读全文
posted @ 2024-05-01 19:02 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #定义矩阵有多种方法,以下是几种常见的实现方式: 二维数组:使用C#的二维数组来表示矩阵。可以使用int[,]类型来定义一个整数矩阵,如: int[,] matrix = new int[3, 3] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; Jagged数组:使用C#的 阅读全文
posted @ 2024-04-30 15:32 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 给你一个数组 nums ,数组中有 2n 个元素,按 [x1,x2,...,xn,y1,y2,...,yn] 的格式排列。 请你将数组按 [x1,y1,x2,y2,...,xn,yn] 格式重新排列,返回重排后的数组。 我写的: public int[] Shuffle(int[] nums, in 阅读全文
posted @ 2024-04-30 14:38 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 原文链接:https://blog.csdn.net/huanggang0101/article/details/99621029 方法一:通过正则表达式进行替换1,HTML 标签的转义方法 //HTML标签转义( < > <) function html2Escape(sHtml) { retur 阅读全文
posted @ 2024-04-29 11:13 yinghualeihenmei 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 原文链接:https://www.cnblogs.com/greatverve/archive/2011/07/18/web-char.html URL中的特殊字符URL中的特殊字符是不能再URL中直接传递的,需要进行编码。编码的格式为:%加字符的ASCII码,即一个百分号%,后面跟对应字符的ASC 阅读全文
posted @ 2024-04-28 19:00 yinghualeihenmei 阅读(1) 评论(0) 推荐(0) 编辑