개발일지/TIL

개발일지/TIL

[leetcode] 148. Sort List

Sort List Given the head of a linked list, return the list after sorting it in ascending order. Example 1: Input: head = [4,2,1,3] Output: [1,2,3,4] Example 2: Input: head = [-1,5,3,4,0] Output: [-1,0,3,4,5] Example 3: Input: head = [] Output: [] Constraints: The number of nodes in the list is in the range [0, 5 * 104]. -105 head.next!.val) { [head.val, head.next!.val] = [head.next!.val, head.va..

개발일지/TIL

[Hash Table 구현] Linear Probing 방식의 Hash Table을 구현해 보세요.

Linear Probing 방식의 Hash Table hash table은 JavaScript에서 { "key" : { "innerKey" : "value" } } 와 같이 사용하는것을 지칭하는것으로 알고 있었는데, linear probing방식으로 구현해보는 과제가 주어져 일단 linear probing이 무엇인지부터 알아보아야겠다. Linear Probing ? 위키디피아에 따르면 linear probing이란, 해시 테이블 의 충돌을 해결하기 위한 컴퓨터 프로그래밍 방식 , 키-값 쌍 의 컬렉션을 유지 관리 하고 주어진 키와 관련된 값을 찾기 위한 데이터 구조 라고한다. 세션을 듣던 중 해싱된 키값이 중복될경우 다음 해싱된 키값으로 저장하는 로직으로 설명을 들었던것을 참고하여 구현하면 될것으로 보인..

개발일지/TIL

[leetcode] 219. Contains Duplicate II

Contains Duplicate II Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j)

개발일지/TIL

[leetcode] 1. Two Sum

Two Sum 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 return [0..

개발일지/TIL

[leetcode] 150. Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation. Evaluate the expression. Return an integer that represents the value of the expression. Note that: The valid operators are '+', '-', '*', and '/'. Each operand may be an integer or another expression. The division between two integers always truncates t..

개발일지/TIL

[leetcode] 155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: MinStack() initializes the stack object. void push(int val) pushes the element val onto the stack. void pop() removes the element on the top of the stack. int top() gets the top element of the stack. int getMin() retrieves the minimum element in the stack. You must impl..

JangKroed
'개발일지/TIL' 카테고리의 글 목록