컴퓨터공학/LeetCode 1000

    [LeetCode] 124. Binary Tree Maximum Path Sum

    [LeetCode] 124. Binary Tree Maximum Path Sum

    124. Binary Tree Maximum Path Sum Hard A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root. The path sum of a path is the sum of the node's values in the path. Given the root of a binary tree, return the maximum p..

    [LeetCode] 84. Largest Rectangle in Histogram

    [LeetCode] 84. Largest Rectangle in Histogram

    84. Largest Rectangle in Histogram Hard Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Example 1: Input: heights = [2,1,5,6,2,3] Output: 10 Explanation: The above is a histogram where width of each bar is 1. The largest rectangle is shown in the red area, which has an area = 1..

    [LeetCode] 25. Reverse Nodes in k-Group

    [LeetCode] 25. Reverse Nodes in k-Group

    25. Reverse Nodes in k-Group Hard Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is. You may not alter the values in the list's nodes, only nodes themselves..

    [LeetCode] 23. Merge k Sorted Lists

    23. Merge k Sorted Lists Hard You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1: Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Explanation: The linked-lists are: [ 1->4->5, 1->3->4, 2->6 ] merging them into one sorted list: 1->1->2->3->4->4->5->6 Example..

    [LeetCode - Biweekly Contest 90]2454. Next Greater Element IV

    2454. Next Greater Element IV Hard You are given a 0-indexed array of non-negative integers nums. For each integer in nums, you must find its respective second greater integer. The second greater integer of nums[i] is nums[j] such that: j > i nums[j] > nums[i] There exists exactly one index k such that nums[k] > nums[i] and i < k < j. If there is no such nums[j], the second greater integer is co..

    [LeetCode - Biweekly Contest 90] 2453. Destroy Sequential Targets

    2453. Destroy Sequential Targets Medium You are given a 0-indexed array nums consisting of positive integers, representing targets on a number line. You are also given an integer space. You have a machine which can destroy targets. Seeding the machine with some nums[i] allows it to destroy all targets with values that can be represented as nums[i] + c * space, where c is any non-negative integer..

    [LeetCode - Biweekly Contest 90] 2451. Odd String Difference

    2451. Odd String Difference Easy You are given an array of equal-length strings words. Assume that the length of each string is n. Each string words[i] can be converted into a difference integer array difference[i] of length n - 1 where difference[i][j] = words[i][j+1] - words[i][j] where 0

    [LeetCode - Biweekly Contest 90] 2452. Words Within Two Edits of Dictionary

    2452. Words Within Two Edits of Dictionary Medium You are given two string arrays, queries and dictionary. All words in each array comprise of lowercase English letters and have the same length. In one edit you can take a word from queries, and change any letter in it to any other letter. Find all words from queries that, after a maximum of two edits, equal some word from dictionary. Return a li..