摘要:
class Solution { public int searchInsert(int[] nums, int target) { int len=nums.length; int l=0,r=len-1,ans=len; while(l<=r){ int mid = (r+l)/2; if(nu 阅读全文
posted @ 2020-07-17 14:51
浅滩浅
阅读(110)
评论(0)
推荐(0)
摘要:
class Solution { Stack<Character> stk = new Stack<>(); public boolean isValid(String s) { int len=s.length(); for(int i=0;i<len;i++){ char ch = s.char 阅读全文
posted @ 2020-07-17 14:48
浅滩浅
阅读(103)
评论(0)
推荐(0)
摘要:
二分找左右边界 class Solution { public int search(int[] nums, int target) { int start=findLeft(nums,target),end=findRight(nums,target); if(start 1||end 1) re 阅读全文
posted @ 2020-07-17 11:08
浅滩浅
阅读(303)
评论(0)
推荐(0)
摘要:
解题:利用二分找到一个相等的元素,之后再左右边界 class Solution { public int[] searchRange(int[] nums, int target) { int n=nums.length; int l=0,r=n-1; int start=-1,end=-1; wh 阅读全文
posted @ 2020-07-17 10:08
浅滩浅
阅读(189)
评论(0)
推荐(0)