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
凌晨三点半的飞机
阅读(184)
推荐(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
凌晨三点半的飞机
阅读(151)
推荐(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
凌晨三点半的飞机
阅读(175)
推荐(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
凌晨三点半的飞机
阅读(204)
推荐(0)
摘要:
找出字符串中第一个只出现一次的字符 package my; import java.util.HashMap; //问题:在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符, //并返回它的位置, 如果没有则返回 -1(需要区分大小写). public cla
阅读全文
posted @ 2020-09-14 00:09
凌晨三点半的飞机
阅读(254)
推荐(0)
2020年9月13日
摘要:
package my; import java.util.HashMap; public class DelStringSolution { //输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。 //例如,输入”They are students.”和”aeiou”,则删除之后的第一个字
阅读全文
posted @ 2020-09-13 18:56
凌晨三点半的飞机
阅读(1181)
推荐(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
凌晨三点半的飞机
阅读(150)
推荐(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
凌晨三点半的飞机
阅读(170)
推荐(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
凌晨三点半的飞机
阅读(289)
推荐(0)
2020年9月8日
摘要:
无重叠区间: package my; import java.util.Arrays; //435.无重叠区间 public class NoOverlapIntervals { int eraseOverlapIntervals(int[][] intervals){ //在主体函数里,先将区间按
阅读全文
posted @ 2020-09-08 00:30
凌晨三点半的飞机
阅读(194)
推荐(0)