- Today
- Total
목록전체 글 (384)
작심삼일

문제 링크: 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 ..
문제 링크: https://leetcode.com/problems/add-one-row-to-tree/ 문제 Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth. Note that the root node is at depth 1. The adding rule is: Given the integer depth, for each not null tree node cur at the depth depth - 1, create two tree nodes with value val as cur's left subtree root and right..
문제 링크: https://leetcode.com/problems/path-sum/ 문제 Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no children. 조건 The number of nodes in the tree is in the range [0, 5000]. -1000
문제 링크:https://leetcode.com/problems/find-k-closest-elements/ 문제 Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending order. An integer a is closer to x than an integer b if: |a - x| < |b - x|, or |a - x| == |b - x| and a < b 조건 1
문제 링크: https://leetcode.com/problems/remove-nth-node-from-end-of-list/ 문제 Given the head of a linked list, remove the nth node from the end of the list and return its head. 조건 The number of nodes in the list is sz. 1