摘要:
class Solution { public String fractionToDecimal(int numerator, int denominator) { StringBuilder sb=new StringBuilder(); if(numerator0||numerator>0&&denominator0) sb.a... 阅读全文
摘要:
class Solution { public int compareVersion(String version1, String version2) { String[] v1=version1.split("\\."); String[] v2=version2.split("\\."); int i=0; ... 阅读全文
摘要:
class Solution { public int maximumGap(int[] nums) { if(nums.length<2) return 0; int max=Integer.MIN_VALUE; int min=Integer.MAX_VALUE; for(int num:nums... 阅读全文
摘要:
ph 阅读全文
摘要:
class Solution { public int findPeakElement(int[] nums) { for(int i=0;i0&&nums[i]>nums[i-1])&&(i==nums.length-1||inums[i+1])) return i; return -1; } } 阅读全文
摘要:
ph 阅读全文
摘要:
ph 阅读全文
摘要:
ph 阅读全文
摘要:
ph 阅读全文
摘要:
class Solution { public int findMin(int[] nums) { int lo=0; int hi=nums.length-1; while(lonums[hi]) lo=mid+1; else hi--; ... 阅读全文
摘要:
class Solution { public int findMin(int[] nums) { int lo=0; int hi=nums.length-1; while(lo<hi) { int mid=(lo+hi)/2; if(nums[mid]<nums[hi]) ... 阅读全文