2020年9月15日
摘要: package my; import java.util.Arrays; public class MissNumberSolution { public int missingNumber(int[] nums) { Arrays.sort(nums); if (nums[nums.length- 阅读全文
posted @ 2020-09-15 02:23 凌晨三点半的飞机 阅读(177) 评论(0) 推荐(0) 编辑
摘要: package my; public class IsUglySolution { boolean isUgly(int num){ if(num == 0){ return false; } while(num !=1){ if(num % 2 == 0){ num /= 2 ; continue 阅读全文
posted @ 2020-09-15 01:35 凌晨三点半的飞机 阅读(143) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void moveZeroes(int[] nums) { int result=0 ; for(int i =0 ;i < nums.length;i ++){ if(nums[i]!= 0){ nums[result++] = nums[i]; } 阅读全文
posted @ 2020-09-15 00:48 凌晨三点半的飞机 阅读(167) 评论(0) 推荐(0) 编辑
  2020年9月14日
摘要: package my; import java.util.HashMap; public class FindStringMaxSolution { int findStrMax(String str){ if(str.length() == 0 || str == null){ return -1 阅读全文
posted @ 2020-09-14 02:08 凌晨三点半的飞机 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 找出字符串中第一个只出现一次的字符 package my; import java.util.HashMap; //问题:在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符, //并返回它的位置, 如果没有则返回 -1(需要区分大小写). public cla 阅读全文
posted @ 2020-09-14 00:09 凌晨三点半的飞机 阅读(232) 评论(0) 推荐(0) 编辑
  2020年9月13日
摘要: package my; import java.util.HashMap; public class DelStringSolution { //输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。 //例如,输入”They are students.”和”aeiou”,则删除之后的第一个字 阅读全文
posted @ 2020-09-13 18:56 凌晨三点半的飞机 阅读(1104) 评论(0) 推荐(0) 编辑
  2020年9月11日
摘要: package my; public class RomanNumberSolution { public String intToRoman(int num){ String[] thousands = {"", "M", "MM", "MMM"}; String[] hundreds = {"" 阅读全文
posted @ 2020-09-11 22:21 凌晨三点半的飞机 阅读(134) 评论(0) 推荐(0) 编辑
摘要: package my; public class MaxAreaSolution { public int maxArea(int[] height){ if(height.length <1){ return 0; } int max = 0; int current =0; for(int i= 阅读全文
posted @ 2020-09-11 02:53 凌晨三点半的飞机 阅读(159) 评论(0) 推荐(0) 编辑
  2020年9月9日
摘要: 删除重叠的区间的个数 package my; import java.util.Arrays; public class NoOverlapIntervals2 { int eraseOverlapIntervals(int[][] intervals){ if(intervals.length = 阅读全文
posted @ 2020-09-09 02:23 凌晨三点半的飞机 阅读(271) 评论(0) 推荐(0) 编辑
  2020年9月8日
摘要: 无重叠区间: package my; import java.util.Arrays; //435.无重叠区间 public class NoOverlapIntervals { int eraseOverlapIntervals(int[][] intervals){ //在主体函数里,先将区间按 阅读全文
posted @ 2020-09-08 00:30 凌晨三点半的飞机 阅读(183) 评论(0) 推荐(0) 编辑