컴퓨터공학/LeetCode 1000

    [LeetCode] 113. Path Sum II

    [LeetCode] 113. Path Sum II

    113. Path Sum II Medium Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of the node values, not node references. A root-to-leaf path is a path starting from the root and ending at any leaf node. A leaf is a node with no children. Example 1: Input: root = [..

    [LeetCode] 838. Push Dominoes

    [LeetCode] 838. Push Dominoes

    838. Push Dominoes Medium There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right. After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right. W..

    [LeetCode] 985. Sum of Even Numbers After Queries

    985. Sum of Even Numbers After Queries Medium You are given an integer array nums and an array queries where queries[i] = [vali, indexi]. For each query i, first, apply nums[indexi] = nums[indexi] + vali, then print the sum of the even values of nums. Return an integer array answer where answer[i] is the answer to the ith query. Example 1: Input: nums = [1,2,3,4], queries = [[1,0],[-3,1],[-4,0],..

    [LeetCode] 298. Binary Tree Longest Consecutive Sequence

    [LeetCode] 298. Binary Tree Longest Consecutive Sequence

    298. Binary Tree Longest Consecutive Sequence Medium Given the root of a binary tree, return the length of the longest consecutive sequence path. A consecutive sequence path is a path where the values increase by one along the path. Note that the path can start at any node in the tree, and you cannot go from a node to its parent in the path. Example 1: Input: root = [1,null,3,2,4,null,null,null,..

    [LeetCode] 990. Satisfiability of Equality Equations

    990. Satisfiability of Equality Equations Medium You are given an array of strings equations that represent relationships between variables where each string equations[i] is of length 4 and takes one of two different forms: "xi==yi" or "xi!=yi".Here, xi and yi are lowercase letters (not necessarily different) that represent one-letter variable names. Return true if it is possible to assign integ..

    [LeetCode] 159. Longest Substring with At Most Two Distinct Characters

    159. Longest Substring with At Most Two Distinct Characters Medium Given a string s, return the length of the longest substring that contains at most two distinct characters. Example 1: Input: s = "eceba" Output: 3 Explanation: The substring is "ece" which its length is 3. Example 2: Input: s = "ccaabbb" Output: 5 Explanation: The substring is "aabbb" which its length is 5. Constraints: 1 2: cnt..

    [LeetCode] 1680. Concatenation of Consecutive Binary Numbers

    1680. Concatenation of Consecutive Binary Numbers Medium Given an integer n, return the decimal value of the binary string formed by concatenating the binary representations of 1 to n in order, modulo 109 + 7. Example 1: Input: n = 1 Output: 1 Explanation: "1" in binary corresponds to the decimal value 1. Example 2: Input: n = 3 Output: 27 Explanation: In binary, 1, 2, and 3 corresponds to "1", ..

    [LeetCode] 1272. Remove Interval

    [LeetCode] 1272. Remove Interval

    1272. Remove Interval Medium A set of real numbers can be represented as the union of several disjoint intervals, where each interval is in the form [a, b). A real number x is in the set if one of its intervals [a, b) contains x (i.e. a