- Today
- Total
목록스터디/코테 (223)
작심삼일
문제 링크: https://leetcode.com/problems/integer-to-roman/ 문제 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + II. Roman numerals are usua..
문제 링크: https://leetcode.com/problems/top-k-frequent-words/ 문제 Given an array of strings words and an integer k, return the k most frequent strings. Return the answer sorted by the frequency from highest to lowest. Sort the words with the same frequency by their lexicographical order. 조건 1
문제 링크: https://leetcode.com/problems/count-and-say/ 문제 The count-and-say sequence is a sequence of digit strings defined by the recursive formula: countAndSay(1) = "1" countAndSay(n) is the way you would "say" the digit string from countAndSay(n-1), which is then converted into a different digit string. To determine how you "say" a digit string, split it into the minimal number of substrings suc..
문제 링크: https://leetcode.com/problems/delete-the-middle-node-of-a-linked-list/ 문제 You are given the head of a linked list. Delete the middle node, and return the head of the modified linked list. The middle node of a linked list of size n is the ⌊n / 2⌋th node from the start using 0-based indexing, where ⌊x⌋ denotes the largest integer less than or equal to x. For n = 1, 2, 3, 4, and 5, the middl..
문제 링크: https://leetcode.com/problems/delete-node-in-a-linked-list/ 문제 There is a singly-linked list head and we want to delete a node node in it. You are given the node to be deleted node. You will not be given access to the first node of head. All the values of the linked list are unique, and it is guaranteed that the given node node is not the last node in the linked list. Delete the given nod..
문제 링크: https://leetcode.com/problems/largest-perimeter-triangle/ 문제 Given an integer array nums, return the largest perimeter of a triangle with a non-zero area, formed from three of these lengths. If it is impossible to form any triangle of a non-zero area, return 0. 조건 3 int: nums.sort(reverse=True) for i in range(len(nums)-2): if nums[i] < (nums[i+1]+nums[i+2]): return sum(nums[i:i+3]) return 0
문제 링크: https://leetcode.com/problems/increasing-triplet-subsequence/ 문제 Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exists, return false. 조건 1
문제 링크: https://leetcode.com/problems/time-based-key-value-store/ 문제 Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp. Implement the TimeMap class: TimeMap() Initializes the object of the data structure. void set(String key, String value, int timestamp) Stores the key key with ..