분류 전체보기

    [LeetCode] Merge k Sorted Lists (Java)

    ✉️문제 https://leetcode.com/problems/merge-k-sorted-lists/description/ Merge k Sorted Lists - LeetCode Can you solve this real interview question? Merge k Sorted Lists - You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1: Input: lis leetcode.com 🗝 문제풀이 1. Collection과 Collecti..

    서로 다른 타임존에서 데이터 핸들링 하기

    🔍 상이한 타임존이 가져오는 문제점 지금 하고 있는 "Voca-World"는 언어 학습 웹 서비스로 다양한 국가의 사용자가 이용할 예정이므로 서로 다른 타임존이 갖는 문제를 해결해야 했다. 가장 큰 문제는 오늘 공부한 단어를 조회하는 로직이었다. 만약 한국 시간으로 2023/07/28 06:00시에 단어를 저장했다면 UTC 시간을 갖는 국가의 경우 2023/07/27 21:00시가 된다. 즉 오늘 공부한 단어 조회가 안되게 된다. 🔍 단어 조회 로직 단어 조회 로직은 파라미터로 클라이언트의 시간을 전달받아서 날짜를 추출하는 형식으로 구성되어있다. @Override public List findWordsWithDate(WordDTO.Request request) { LocalDate now = DateFo..

    TimeZone으로 인한 데이터 조회 실패

    TimeZone으로 인한 데이터 조회 실패

    현재 Voca-World라고 하는 언어 학습 웹 서비스를 운영중이다. 최근에 AWS와 Docker를 이용하여 서버를 배포했는데 저장한 영어 단어가 조회되지 않는 현상이 발생했다. 이 문제를 해결한 과정을 기록하려고 한다. 🔍 문제 해결 과정 문제의 원인을 살펴보기 위해 서버의 로그 파일을 확인해 보았다. 단어 저장시 문제가 생겼을 수 있기 때문에 단어 저장 -> 단어 조회 순서로 로그를 확인해봤다. 저장한 시간보다 9시간 늦은 시간으로 표기되었지만 타임존이 다른걸 생각해보면 문제는 없어보였다. 하지만 로그를 편하게 보기 위해 로그의 시간 기록도 한국 시간으로 바꿔주었다. [logback-variables.properties] LOG_PATTERN=[%-5level] %d{yyyy-MM-dd HH:mm:s..

    [LeetCode] Longest Consecutive Sequence (Java)

    ✉️문제 https://leetcode.com/problems/longest-consecutive-sequence/ Longest Consecutive Sequence - LeetCode Can you solve this real interview question? Longest Consecutive Sequence - Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Example 1: Input: leetcode.com 🗝 문제풀이 class Solution { publi..

    [LeetCode] Pacific Atlantic Water Flow (Java)

    ✉️문제 https://leetcode.com/problems/pacific-atlantic-water-flow/ Pacific Atlantic Water Flow - LeetCode Can you solve this real interview question? Pacific Atlantic Water Flow - There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches leetcode.com 🗝 문제풀이 class Solution { f..