摘要: import java.util.ArrayList;import java.util.List;//147. 水仙花数//输入n位数如153 =1^3+5^3+3^3public class Demo10 { public static void main(String[] args) { Lis 阅读全文
posted @ 2020-12-04 14:58 YMNZZ 阅读(70) 评论(0) 推荐(0)
摘要: 注意:明确每一次赋值给新数组的数据的行和列 public class Demo08 { public static void main(String[] args) { int[][] arr ={{1,2,5},{3,4,6},{7,8,9}}; spin(arr); } public stati 阅读全文
posted @ 2020-12-01 09:52 YMNZZ 阅读(102) 评论(0) 推荐(0)
摘要: /*给一个整数数组,找到两个数使得他们的和等于一个给定的数 target。你需要实现的函数twoSum需要返回这两个数的下标例:给出 numbers = [15, 2, 7, 11], target = 9, 返回 [1, 2]. */public class Demo05 { public sta 阅读全文
posted @ 2020-11-28 21:00 YMNZZ 阅读(101) 评论(0) 推荐(0)
摘要: public class Demo06 { //给定一个只包含字母的字符串,按照先小写字母后大写字母的顺序进行排序。 //样例 1: // 输入: "abAcD" // 输出: "acbAD" public static void main(String[] args) { char[] array 阅读全文
posted @ 2020-11-28 20:38 YMNZZ 阅读(682) 评论(0) 推荐(0)
摘要: 给定一个字符串(以字符数组的形式给出)和一个偏移量,根据偏移量原地旋转字符串(从左向右旋转)。 样例 : 输入: str="abcdefg", offset = 3 输出: str = "efgabcd" 样例解释: 注意是原地旋转,即str旋转后为"efgabcd" public class De 阅读全文
posted @ 2020-11-26 14:54 YMNZZ 阅读(266) 评论(0) 推荐(0)
摘要: class Solution01 { public static int kthLargestElement(int n, int[] nums) { /*ArrayList<Integer> list =new ArrayList<>(); for (int i = 0; i <nums.leng 阅读全文
posted @ 2020-11-26 14:43 YMNZZ 阅读(66) 评论(0) 推荐(0)