STUDY/LeetCode(16)
-
LeetCode - 733. Flood Fill
DFS.........문제다....... ㅠㅅㅠ; 재귀......다 ! 생각해보면 Ea--------sy한 문제.......? 이해는 요 아래 동영상 보고 이해했다. https://youtu.be/RwozX--B_Xs Question ) An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image.You are also given three integers sr, sc, and color. You should perform a flood fill on the image starting from the pixel image[sr][sc]. To perform a fl..
2022.07.17 -
LeetCode - 19. Remove Nth Node From End of List
HA..... 이거 Two Pointer Category 라고..... ㅠㅠ 이 빠가사리야 (Po자책중wer) Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Input: head = [1,2], n = 1 Output: [1] Constraints: The number of nodes in the list is sz. 1 next = H2->next->next; r..
2022.07.16 -
LeetCode - 876. Middle of the Linked List
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. 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] Explanation: Since the list has two middle nodes with values 3 and 4, we return the second on..
2022.07.16 -
LeetCode - Reverse Words in a String III
허잉 ㅜㅜ Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: s = "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" Example 2: Input: s = "God Ding" Output: "doG gniD" Constraints: 1
2022.07.16 -
LeetCode 189. Rotate Array
Given an array, rotate the array to the right by 'k' steps, where 'k' is non-negative. Ex 1) Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4] Ex 2) Input: nums = [-1,-100,3,99], k = 2 Output: [3,99,-1,-100] Explanation: rotate 1 steps to ..
2022.07.08 -
LeetCode - 704. Binary Search
역쉬.... 사람은 공부를 계속 해야합니다 ... 허허허 이런 문제 하나 맞추거 겁나 좋아하는 나라니 여태 뭘한건가요 ~ ㅠㅠ https://leetcode.com/problems/binary-search/ Binary Search - 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 요 문제 ! E-Z ~ int search(int* nums, int numsSize, int target){ int mid = 0; mid = numsSize>>1; if(targe..
2022.07.07