본문 바로가기

Problem Solving10

[Leetcode] 235. Lowest Common Ancestor of a Binary Search Tree Problem Link: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/ Lowest Common Ancestor of a Binary Search Tree - LeetCode Can you solve this real interview question? Lowest Common Ancestor of a Binary Search Tree - Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA .. 2023. 7. 18.
[Leetcode] 733. Flood Fill Problem Link: https://leetcode.com/problems/flood-fill/ Flood Fill - LeetCode Can you solve this real interview question? Flood Fill - An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and color. You should perform a flood fill leetcode.com Solution 1. BFS Time: $O(\text{log } N)$ Space: $O(.. 2023. 7. 18.
[Leetcode] 704. Binary Search Problem Link: https://leetcode.com/problems/binary-search/ Binary Search - LeetCode Can you solve this real interview question? Binary Search - Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. leetcode.com Solution 1. Binary Search Time: $O(\text{log.. 2023. 7. 17.
[Leetcode] 242. Valid Anagram Problem Link: https://leetcode.com/problems/valid-anagram/ Valid Anagram - LeetCode Can you solve this real interview question? Valid Anagram - Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using leetcode.com Solution 1. Hash Table (Iteration) Time: $O(.. 2023. 7. 13.