Eat Study Love

먹고 공부하고 사랑하라

coding 17

Palindrome Linked List[Linked List,Two Pointers,Stack,Recursion]

https://leetcode.com/problems/palindrome-linked-list/description/Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1:Input: head = [1,2,2,1]Output: trueExample 2:Input: head = [1,2]Output: false Constraints:The number of nodes in the list is in the range [1, 105].0  Follow up: Could you do it in O(n) time and O(1) space? 해당 문제를 Recursion / Data..

Coding_Practice 2024.09.23

Rotate List[Linked List,Two Pointers]

https://leetcode.com/problems/rotate-list/description/Given the head of a linked list, rotate the list to the right by k places. Example 1:Input: head = [1,2,3,4,5], k = 2Output: [4,5,1,2,3]Example 2:Input: head = [0,1,2], k = 4Output: [2,0,1] Constraints:The number of nodes in the list is in the range [0, 500].-100 0 1. C또 Naive하게 했다가 얻어 맞은 Time Limit ㅠㅠC는 빠른 언어라 상관 없을 줄 알았는데 얄짤 없네/** * Definit..

Coding_Practice 2024.08.20

Find K-th Smallest Pair Distance[H,Array,Two Pointers,Binary Search,Sorting]

https://leetcode.com/problems/find-k-th-smallest-pair-distance/description/?envType=daily-question&envId=2024-08-14The distance of a pair of integers a and b is defined as the absolute difference between a and b.Given an integer array nums and an integer k, return the kth smallest distance among all the pairs nums[i] and nums[j] where 0  Example 1:Input: nums = [1,3,1], k = 1Output: 0Explanation..

Coding_Practice 2024.08.14

Median of Two Sorted Arrays[H,Array,Binary Search,Divide and Conquer]

https://leetcode.com/problems/median-of-two-sorted-arrays/description/Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.The overall run time complexity should be O(log (m+n)). Example 1:Input: nums1 = [1,3], nums2 = [2]Output: 2.00000Explanation: merged array = [1,2,3] and median is 2.Example 2:Input: nums1 = [1,2], nums2 = [3,4]Outp..

Coding_Practice 2024.08.12

Minimum Number of Pushes to Type Word II[M,Hash Table,String,Greedy,Sorting,Counting]

https://leetcode.com/problems/minimum-number-of-pushes-to-type-word-ii/description/?envType=daily-question&envId=2024-08-06 You are given a string word containing lowercase English letters.Telephone keypads have keys mapped with distinct collections of lowercase English letters, which can be used to form words by pushing them. For example, the key 2 is mapped with ["a","b","c"], we need to push ..

Coding_Practice 2024.08.06

Kth Distinct String in an Array[E,Array,Hash Table,String,Counting]

https://leetcode.com/problems/kth-distinct-string-in-an-array/description/?envType=daily-question&envId=2024-08-05A distinct string is a string that is present only once in an array.Given an array of strings arr, and an integer k, return the kth distinct string present in arr. If there are fewer than k distinct strings, return an empty string "".Note that the strings are considered in the order ..

Coding_Practice 2024.08.05