- Today
- Total
목록스터디 (246)
작심삼일
문제 링크: https://leetcode.com/problems/n-ary-tree-level-order-traversal/ 문제 Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). 조건 The height of the n-ary tree is less than or equal to 1000 The total number of nodes is between [0..
문제 링크: https://leetcode.com/problems/average-of-levels-in-binary-tree/ 문제 Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within $10^{-5}$ of the actual answer will be accepted. 조건 The number of nodes in the tree is in the range [1, $10^4$]. $-2^{31}$
문제 링크: https://leetcode.com/problems/count-good-nodes-in-binary-tree/ 문제 Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in the binary tree. 조건 The number of nodes in the binary tree is in the range [1, 10^5]. Each node's value is between [-10^4, 10^4]. 내 풀이 Tree 구조는 항상 recu..
문제 링크: https://leetcode.com/problems/pacific-atlantic-water-flow/ 문제 There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges. The island is partitioned into a grid of square cells. You are given an m x n integer matrix heights where he..
문제 링크: https://leetcode.com/problems/rotate-image/ 문제 You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. 조건 n == matrix.length == matrix[i].length 1
문제 링크: https://leetcode.com/problems/number-of-islands/ 문제 Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. 조건 m == grid.length n == grid[i].length 1
문제 링크: https://leetcode.com/problems/ransom-note/ Ransom Note - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise. Each letter in magazine..
문제 링크: https://leetcode.com/problems/power-of-three/ 문제 Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == $3^x$. 조건 $-2^{31}$ 1: remain = n % 3 if remain > 0: return False n = n // 3 return True