Coding Challenges 28

[SQL50] 595. Big Countries

난이도: EASY 문제더보기Table: World +-------------+---------+ | Column Name | Type    | +-------------+---------+ | name        | varchar | | continent   | varchar | | area        | int     | | population  | int     | | gdp         | bigint  | +-------------+---------+ name is the primary key (column with unique values) for this table. Each row of this table gives information about the name of a country..

[SQL50] 584. Find Customer Referee

난이도: EASY 문제더보기Table: Customer+-------------+--------------+ | Column Name | Type | +-------------+--------------+ | id                | int          | | name         | varchar   | | referee_id  | int           | +-------------+--------------+ In SQL, id is the primary key column for this table. Each row of this table indicates the id of a customer, their name, and the id of the customer who ref..

[SQL50] 1757. Recyclable and Low Fat Products

난이도: EASY 문제문제가 너무 쉬워서 5번 다시 읽음.더보기Table: Products +-------------+---------+ | Column Name | Type    | +-------------+---------+ | product_id  | int     | | low_fats    | enum    | | recyclable  | enum    | +-------------+---------+ product_id is the primary key (column with unique values) for this table. low_fats is an ENUM (category) of type ('Y', 'N') where 'Y' means this product is low fat a..

[Java] 20. Valid Parentheses

난이도: EASY문제더보기Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type. Example 1: Input: s = "()" Output: true Example 2: In..

[Java] 14. Longest Common Prefix

난이도: EASY문제더보기Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: strs = ["flower","flow","flight"] Output: "fl" Example 2: Input: strs = ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input strings.   Constraints: 1 0 strs[i] consists of only lowerca..

[Java] 13. Roman to Integer

난이도: EASY문제더보기Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol       Value I             1 V             5 X             10 L             50 C             100 D             500 M             1000 For example, 2 is written as II in Roman numeral, just two ones added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, ..

[Java] 9. Palindrome Number

난이도: EASY문제더보기Given an integer x, return true if x is a palindrome, and false otherwise.  Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. Example 2: Input: x = -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example 3: Input: x = 10 Output: fal..

[Java] 1. Two sum

난이도: EASY 문제더보기Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we re..