[리트코드][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.
[리트코드LeetCode][Easy][JAVA]21. Merge Two Sorted Lists
문제You are given the heads of two sorted linked lists list1 and list2.Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists.Return the head of the merged linked list. Example 1:Input: list1 = [1,2,4], list2 = [1,3,4]Output: [1,1,2,3,4,4]Example 2:Input: list1 = [], list2 = []Output: []Example 3:Input: list1 = [], list2 = [0]Output:..
2024. 9. 16.