- Today
- Total
목록leetcode (186)
작심삼일
문제 링크: 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
문제 링크: https://leetcode.com/problems/reduce-array-size-to-the-half/ 문제 You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum size of the set so that at least half of the integers of the array are removed. 조건 2
문제 링크: https://leetcode.com/problems/unique-morse-code-words/ 문제 International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: 'a' maps to ".-", 'b' maps to "-...", 'c' maps to "-.-.", and so on. For convenience, the full table for the 26 letters of the English alphabet is given below: [".-","-...","-.-.","-..",".","..-.","--.","......