import java.util.Arrays; import java.util.stream.IntStream; public class KthSmallest { /* * Finds the `k`th smallest integer if the input arrays are combined * * @param a A sorted array of integers * @oaran b A sorted array of integers. The elements of a and b are unique across both arrays. * @param k The index of the desired value if `a` and `b` were merged and sorted (k is one-indexed) * * @returns The `k`th smallest integer if the input arrays are combined */ public static int kthSmallest(int[] a, int[] b, int k) { // TODO: complete this method. Hint: you are welcome to create your own helper methods! } public static void main(String[] args) { // expected: 1 run(new int[] { 1, 3, 4 }, new int[] { 2, 5, 6 }, 1); // expected: 4 run(new int[] { 4, 6, 7 }, new int[] { 1, 2, 5 }, 3); // add more test cases below! } public static void run(int[] a, int[] b, int k) { System.out.println(kthSmallest(a, b, k)); } }