본문 바로가기

전체 글17

[Leetcode] 226. Invert Binary Tree Problem Link: https://leetcode.com/problems/invert-binary-tree/ Invert Binary Tree - LeetCode Can you solve this real interview question? Invert Binary Tree - Given the root of a binary tree, invert the tree, and return its root. Example 1: [https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg] Input: root = [4,2,7,1,3,6,9] Output: [4 leetcode.com Solution 1. Recursion (DFS) Time: $O(.. 2023. 7. 13.
[Leetcode] 125. Valid Palindrome Problem Link: https://leetcode.com/problems/valid-palindrome/ Valid Palindrome - LeetCode Can you solve this real interview question? Valid Palindrome - A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric cha leetcode.com Solution 1. Two Pointers Time: $O(N)$ .. 2023. 7. 12.
[Leetcode] 121. Best Time to Buy and Sell Stock Problem Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/ Best Time to Buy and Sell Stock - LeetCode Can you solve this real interview question? Best Time to Buy and Sell Stock - You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosin leetcode... 2023. 7. 12.
[Leetcode] 21. Merge Two Sorted Lists Problem Link: https://leetcode.com/problems/merge-two-sorted-lists/description/ Merge Two Sorted Lists - LeetCode Can you solve this real interview question? Merge Two Sorted Lists - You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists leetcode.com Solution 1. Tw.. 2023. 7. 12.