Coding Challenges/LeetCode 28

[Java] 28. Find the Index of the First Occurrence in a String

난이도: EASY 문제 링크: https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/문제더보기Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.  Example 1:Input: haystack = "sadbutsad", needle = "sad"Output: 0Explanation: "sad" occurs at index 0 and 6.The first occurrence is at index 0, so we r..

[SQL50] 197. Rising Temperature

난이도: EASY 문제 링크: Rising Temperature - LeetCode 문제더보기Table: Weather+---------------+---------+ | Column Name   | Type    | +---------------+---------+ | id            | int     | | recordDate    | date    | | temperature   | int     | +---------------+---------+ id is the column with unique values for this table. There are no different rows with the same recordDate. This table contains informatio..

[SQL50] 1581. Customer Who Visited but Did Not Make Any Transactions

난이도: EASY 문제 링크: https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/submissions/1539880821/?envType=study-plan-v2&envId=top-sql-50문제더보기Table: Visits +-------------+---------+ | Column Name | Type    | +-------------+---------+ | visit_id    | int     | | customer_id | int     | +-------------+---------+ visit_id is the column with unique values for this table. T..

[SQL50] 1068. Product Sales Analysis I

난이도: EASY 문제 링크 : https://leetcode.com/problems/product-sales-analysis-i/description/?envType=study-plan-v2&envId=top-sql-50 문제더보기Table: Sales +-------------+-------+ | Column Name | Type  | +-------------+-------+ | sale_id     | int   | | product_id  | int   | | year        | int   | | quantity    | int   | | price       | int   | +-------------+-------+ (sale_id, year) is the primary key (com..

[Java] 27. Remove Element

난이도: EASY문제더보기Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val. Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things: Change the array nums such that the first k elem..

[SQL50] 1378. Replace Employee ID With The Unique Identifier

난이도: EASY문제더보기Table: Employees +---------------+---------+ | Column Name   | Type    | +---------------+---------+ | id            | int     | | name          | varchar | +---------------+---------+ id is the primary key (column with unique values) for this table. Each row of this table contains the id and the name of an employee in a company.   Table: EmployeeUNI +---------------+---------+ | C..

[Java] 26. Remove Duplicates from Sorted Array

난이도: EASY문제더보기Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums. Consider the number of unique elements of nums to be k, to get accepted, you need to do the following things: Change the array nums s..

[SQL50] 1148. Article Views I

난이도: EASY 문제더보기Table: Views +---------------+---------+ | Column Name   | Type    | +---------------+---------+ | article_id    | int     | | author_id     | int     | | viewer_id     | int     | | view_date     | date    | +---------------+---------+ There is no primary key (column with unique values) for this table, the table may have duplicate rows. Each row of this table indicates that some ..

[SQL50] 1683. Invalid Tweets

난이도: EASY 문제더보기Table: Tweets+----------------+---------+ | Column Name    | Type    | +----------------+---------+ | tweet_id       | int     | | content        | varchar | +----------------+---------+ tweet_id is the primary key (column with unique values) for this table. content consists of characters on an American Keyboard, and no other special characters. This table contains all the tweets ..

[Java] 21. Merge Two Sorted Lists

난이도: EASY문제더보기You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. Example 1: Input: list1 = [1,2,4], list2 = [1,3,4] Output: [1,1,2,3,4,4]Example 2: Input: list1 = [], list2 = [] Output: [] Example 3: Input: list1 = []..