leetcode

    [LeetCode] 819. Most Common Word

    https://leetcode.com/problems/most-common-word/ Most Common Word - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com banned 목록에 없는 단어 중 가장 많이 반복된 단어 return String 구현 문제(?)인데, 난 이런 문제는 꼭 Map을 쓰고 싶더라 (아주 제격이다) class Solution { public String mostCommonWord(String paragraph, String[] ban..

    [LeetCode] 460. LFU Cache

    https://leetcode.com/problems/lfu-cache/description/ LFU Cache - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com key, value 값을 저장해야해서 map을 사용해야겠다고 생각했다. 그래서, key, value 저장 map 하나와 key, user counter를 저장 할 map을 각각 선언해서 풀려고 했는데, 일부 테스트케이스에서 막힌다. class LFUCache { private Map cache; // ..

    [LeetCode] 141. Linked List Cycle

    leetcode.com/problems/linked-list-cycle/ Linked List Cycle - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 주어진 Linked List가 cycle 형태를 가지고 있는지 리턴 public class Solution { public boolean hasCycle(ListNode head) { if (head == null){ return false; } List nodeList = new LinkedList(); w..

    [LeetCode] Palindrome Linked List

    leetcode.com/explore/featured/card/top-interview-questions-easy/93/linked-list/772 Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 주어진 Linked List 가 앞부터 읽었을때와 뒤에서 읽었을 때 값이 같은 지 리턴 [1, 2, 2, 1] ➡ true [1, 2] ➡ false clas..