[Medium] 143. Reorder List
leetCode 2022. 7. 19. 09:54

문제 https://leetcode.com/problems/reorder-list/ Reorder List - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - ..

[Medium] 556. Next Greater Element III
leetCode 2022. 7. 5. 12:21

문제 https://leetcode.com/problems/next-greater-element-iii/ Next Greater Element III - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If..

[Easy] 28. Implement strStr()
leetCode 2022. 6. 9. 11:16

문제 Implement 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. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will return 0 when needle is an empty string. This is consistent to C's s..

[Easy] 876. Middle of the Linked List
leetCode 2022. 6. 6. 14:35

문제 Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. head단일 연결 목록이 주어지면 연결 목록 의 중간 노드를 반환합니다 . 두 개의 중간 노드가 있는 경우 두 번째 중간 노드를 반환 합니다. 예시 Example 1: Input: head = [1,2,3,4,5] Output: [3,4,5] Explanation: The middle node of the list is node 3. Example 2: Input: head = [1,2,3,4,5,6] Output: [4,5,6] Explana..

[Easy] 1768. Merge Strings Alternately
leetCode 2022. 6. 2. 10:44

문제 You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string. Return the merged string. 예시 Example 1: Input: word1 = "abc", word2 = "pqr" Output: "apbqcr" Explanation: The merged string will be merged as so: word1: a b c word2: p q ..

[Easy] 202. Happy Number
leetCode 2022. 5. 30. 01:02

문제 Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy..