[leetCode] 35. Search Insert Position (Easy) 풀이 ❓ 문제 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. 런타임 복잡도가 'O(log n)'인 알고리즘을 작성해야 합니다. Example 1 Input: nums = [1,3,5,6], t.. [leetCode] 28. Implement strStr() (Easy) 풀이 ❓ 문제 Implement strStr(). strStr()을 구현합니다. Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 두 개의 문자열 needle과 haystack이 주어지면 haystack에서 needle이 처음 나타나는 색인을 반환하거나 needle이 haystack의 일부가 아닌 경우 -1을 반환합니다. Clarification: What should we return when needle is an empty string? This is a great question to ask dur.. [leetCode] 27. Remove Element (Easy) 풀이 ❓ 문제 Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed. 정수 배열 nums와 정수 val이 주어지면 nums에서 val의 모든 항목을 제자리에서 제거합니다. 요소의 상대적 순서는 변경될 수 있습니다. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More form.. [leetCode] 26. Remove Duplicates from Sorted Array (Easy) 풀이 ❓ 문제 Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. 내림차순으로 정렬된 정수 배열 nums가 주어지면 각 고유 요소가 한 번만 나타나도록 중복을 제자리에서 제거합니다. 요소의 상대적 순서는 동일하게 유지되어야 합니다. Since it is impossible to change the length of the array in some languages, you must instead have th.. [leetCode] 21. Merge Two Sorted Lists (Easy) 풀이 ❓ 문제 You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a 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. 정렬된 두 개의 링크 리스트 list1과 list2의 헤드가 제공됩니다. 두 리스트를 하나의 정렬된 리스트로 병합하세요. 리스트는 처음 두 리스트의 노드를 연결하여 만들어야 합니다. 병합된 링크 리스트의 헤드를 반환하세요. Example 1 Input: list1 = [1,2,4], li.. [leetCode] 20. Valid Parentheses (Easy) 풀이 ❓ 문제 Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. '(', ')', '{', '}', '[' 그리고 ']' 로 이루어진 주어진 문자열이 유효한지 알아내세요. 문자열이 유효한 경우: 열린 괄호가 닫힌 괄호와 모양이 일치해야합니다. 열리 괄호는 올바를 순서로 닫혀야합니다. Example 1 .. 이전 1 2 3 다음