[리트코드LeetCode][Easy][JAVA]1929. Concatenation of Array
문제Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 (0-indexed).Specifically, ans is the concatenation of two nums arrays.Return the array ans. Example 1:Input: nums = [1,2,1]Output: [1,2,1,1,2,1]Explanation: The array ans is formed as follows:- ans = [nums[0],nums[1],nums[2],nums[0],nums[1],nums[2]]- an..
2025. 1. 26.
[리트코드][LeetCode][Easy][JAVA]35. Search Insert Position
문제Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You must write an algorithm with O(log n) runtime complexity. Example 1:Input: nums = [1,3,5,6], target = 5Output: 2Example 2:Input: nums = [1,3,5,6], target = 2Output: 1Example 3:Input: nums = [1,3,5,6], target = 7Output..
2024. 9. 21.