Eat Study Love

먹고 공부하고 사랑하라

코딩 57

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

Kth Largest Element in a Stream[E,Tree,Design,Binary Search Tree,Heap (Priority Queue),Binary Tree,Data Stream]

https://leetcode.com/problems/kth-largest-element-in-a-stream/description/?envType=daily-question&envId=2024-08-12Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.Implement KthLargest class:KthLargest(int k, int[] nums) Initializes the object with the integer k and the stream of integers nums.int..

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

Linked List Loops(Python)

Linked list의 loop이 있는지 확인하는 건 1칸 씩 이동하는 slow와 2칸 씩 이동하는 Fast를 선언해서 T/F를 반환할 수 있었다고 알고 있었는데, 전체 list의 길이를 반환하는 거는 처음봤다. 일차적으로 내가 풀었을 땐 # Do not modify!class LinkedNode: def __init__(self, value): self.value = value self.next = None def hasLoop(head): if not head : return 0, True if not head.next : return 1,True slow = head fast = head.next cond = False while fast and f..

Coding_Practice 2024.08.02