Is One Array a Rotation of Another? (Java)
Write a function that returns true if one array is a rotation of another.NOTE: There are no duplicates in each of these arrays. Example: [1, 2, 3, 4, 5, 6, 7] is a rotation of [4, 5, 6, 7, 1, 2, 3]. 풀이 import java.util.List;import java.util.ArrayList;import java.util.Arrays; public class IR { public static void main(String[] args) { // NOTE: The following input values will be used for testing yo..
더보기
Common Elements in Two Sorted Arrays (Java)
Write a function that returns the common elements (as an array) between two sorted arrays of integers (ascending order).Example: The common elements between [1, 3, 4, 6, 7, 9] and [1, 2, 4, 5, 9, 10] are [1, 4, 9]. 풀이 import java.util.ArrayList;import java.util.HashMap;import java.util.List; public class CE { public static void main(String[] args) { // NOTE: The following input values are used f..
더보기