반응형 릿코드17 [JAVA] 101. Symmetric Tree 목차 문제 Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1,2,2,3,4,4,3] Output: true Example 2: Input: root = [1,2,2,null,3,null,3] Output: false Constraints: The number of nodes in the tree is in the range [1, 1000]. -100 코딩테스트/알고리즘 문제풀이 2022. 12. 29. [JAVA] 100. Same Tree 목차 문제 Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1: Input: p = [1,2,3], q = [1,2,3] Output: true Example 2: Input: p = [1,2], q = [1,null,2] Output: false Example 3: Input: p = [1,2,1], q = [1,1,2] Output: false Constrain.. 코딩테스트/알고리즘 문제풀이 2022. 12. 29. [JAVA] 94. Binary Tree Inorder Traversal 목차 문제 Given the root of a binary tree, return the inorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [1,3,2] Example 2: Input: root = [] Output: [] Example 3: Input: root = [1] Output: [1] Constraints: The number of nodes in the tree is in the range [0, 100]. -100 코딩테스트/알고리즘 문제풀이 2022. 12. 28. [MySQL/Oracle] 627. Swap Salary 목차 문제 Table: Salary +-------------+----------+ | Column Name | Type | +-------------+----------+ | id | int | | name | varchar | | sex | ENUM | | salary | int | +-------------+----------+ id is the primary key for this table. The sex column is ENUM value of type ('m', 'f'). The table contains information about an employee. Write an SQL query to swap all 'f' and 'm' values (i.e., change all 'f' v.. 코딩테스트/SQL 문제풀이 2022. 11. 11. [MySQL/Oracle] 1873. Calculate Special Bonus 목차 문제 Table: Employees +-------------+---------+ | Column Name | Type | +-------------+---------+ | employee_id | int | | name | varchar | | salary | int | +-------------+---------+ employee_id is the primary key for this table. Each row of this table indicates the employee ID, employee name, and salary. Write an SQL query to calculate the bonus of each employee. The bonus of an employee is 100%.. 코딩테스트/SQL 문제풀이 2022. 11. 11. [JAVA] 326. 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 == 3x. Example 1: Input: n = 27 Output: true Explanation: 27 = 33 Example 2: Input: n = 0 Output: false Explanation: There is no x where 3x = 0. Example 3: Input: n = -1 Output: false Explanation: There is no x where 3x = (-1). Const.. 코딩테스트/알고리즘 문제풀이 2022. 11. 9. [MySQL/Oracle] 1693. Daily Leads and Partners 목차 문제 Table: DailySales +-------------+---------+ | Column Name | Type | +-------------+---------+ | date_id | date | | make_name | varchar | | lead_id | int | | partner_id | int | +-------------+---------+ This table does not have a primary key. This table contains the date and the name of the product sold and the IDs of the lead and partner it was sold to. The name consists of only lowercase E.. 코딩테스트/SQL 문제풀이 2022. 11. 8. [MySQL/Oracle] 1741. Find Total Time Spent by Each Employee 목차 문제 Table: Employees +-------------+------+ | Column Name | Type | +-------------+------+ | emp_id | int | | event_day | date | | in_time | int | | out_time | int | +-------------+------+ (emp_id, event_day, in_time) is the primary key of this table. The table shows the employees' entries and exits in an office. event_day is the day at which this event happened, in_time is the minute at which .. 코딩테스트/SQL 문제풀이 2022. 11. 8. [JAVA] 409. Longest Palindrome 목차 문제 Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, "Aa" is not considered a palindrome here. Example 1: Input: s = "abccccdd" Output: 7 Explanation: One longest palindrome that can be built is "dccaccd", whose length is 7. Example 2: Input: s = "a" Outp.. 코딩테스트/알고리즘 문제풀이 2022. 11. 8. [JAVA] 121. 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 choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0. Example 1: Input: prices = [7,1,5,3,6,4] Output: 5 Ex.. 코딩테스트/알고리즘 문제풀이 2022. 11. 8. [JAVA] 876. Middle of the Linked List 목차 문제 Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. Example 1: Input: head = [1,2,3,4,5] Output: [3,4,5] Explanation: The middle node of the list is node 3. Example 2: Input: head = [1,2,3,4,5,6] Output: [4,5,6] Explanation: Since the list has two middle nodes with values 3 and 4, we return the sec.. 코딩테스트/알고리즘 문제풀이 2022. 10. 15. [JAVA] 392. Is Subsequence 목차 문제 Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not). Example 1: Input: s = "abc", t = "ahbgdc".. 코딩테스트/알고리즘 문제풀이 2022. 10. 12. 이전 1 2 다음 반응형