首页 > 学院 > 开发设计 > 正文

LeetCode 153. Find Minimum in Rotated Sorted Array

2019-11-06 09:10:56
字体:
来源:转载
供稿:网友
public class Solution {    public int findMin(int[] nums) {        int h = nums.length - 1;        int l = 0;        int r = 0;        while (h > l) {        	if (nums[l] > nums[h]) {            	r = l;        		l = l + (h - l + 1) / 2;        	} else {        		h = l;        		l = r + 1;        		r++;        	}        }        return nums[h];    }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表