Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Tests {
- public static void main(String[] args) {
- int[] nums = new int[] {10,32,40,43,21,35,37,9,23};
- getSmallest(nums, 1, 5);
- System.out.println(getSmallest(nums, 3, 7) + "hello");
- System.out.println(nums[0]);
- }
- private static int getSmallest(int[] nums, int first, int end) {
- if (end == nums.length - 1) {
- return nums[end];
- }
- int val = min(nums, end + 1);
- if (nums[end] < val)
- return nums[end];
- else
- return getSmallest(nums, first, end);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement