본문 바로가기

algorithm/leetcode13

leetcode Reformat Department Table 풀이 CASE WHEN PIVOT LEETCODE 문제 https://leetcode.com/problems/reformat-department-table/ 요약하면 department 별 1~12월 수입을 출력. 풀이 select id ,sum(case when month = 'Jan' then revenue end) as Jan_Revenue ,sum(case when month = 'Feb' then revenue end) as Feb_Revenue ,sum(case when month = 'Mar' then revenue end) as Mar_Revenue ,sum(case when month = 'Apr' then revenue end) as .. 2020. 9. 29.
[LeetCode] ReverseInteger 문제 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer.. 2020. 7. 11.
[LeetCode] LongestSubstring 문제 Given a string, find the length of the longest substring without repeating characters. Example 1:* Input:* "abcabcbb" Output:* 3 Explanation:* The answer is "abc", with the length of 3. Example 2: Input:* "bbbbb" Output:* 1 Explanation: The answer is "b", with the length of 1. Example 3: Input:* "pwwkew" Output:* 3 Explanation: The answer is "wke", with the length of 3. Note that the answer m.. 2020. 7. 11.
[LeetCode] LongestPalindromicSubstring 문제 https://leetcode.com/problems/longest-palindromic-substring/ 문제풀이 양옆을 비교해 나감. c[i] == c[j] && i-j 2020. 7. 11.