특징 OnMouseDrag 마우스를 사용하여 드래그할 때 발생하는 이벤트이다. 마우스 왼쪽 버튼을 누르고 있는 동안 지속적으로 발생하며, 마우스 커서의 위치에 따라 객체가 이동한다. 따라서 마우스 입력에 반응하고 객체의 위치를 조정하는데 사용된다. OnDrag 마우스, 터치, 게임패드 등 다양한 입력장치에서 발생할 수 있는 이벤트이다. 이 이벤트는 드래그 동작이 발생하는 모든 경우에 호출되는데, 마우스 왼쪽 버튼을 누르고 있는 상태일 필요가 없고, 마우스 외의 다른 입력 장치에서도 동작한다. 따라서 입력 이벤트 자체에 반응하며, 여러가지 동작을 처리하는데 사용된다. 💡 즉, OnMouseDrag는 마우스 왼쪽 버튼을 누르고 있는 동안에만 호출 되는 반면, OnDrag는 여러 입력 장치에서 발생 할 수 있..
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..
Linear Probing 방식의 Hash Table hash table은 JavaScript에서 { "key" : { "innerKey" : "value" } } 와 같이 사용하는것을 지칭하는것으로 알고 있었는데, linear probing방식으로 구현해보는 과제가 주어져 일단 linear probing이 무엇인지부터 알아보아야겠다. Linear Probing ? 위키디피아에 따르면 linear probing이란, 해시 테이블 의 충돌을 해결하기 위한 컴퓨터 프로그래밍 방식 , 키-값 쌍 의 컬렉션을 유지 관리 하고 주어진 키와 관련된 값을 찾기 위한 데이터 구조 라고한다. 세션을 듣던 중 해싱된 키값이 중복될경우 다음 해싱된 키값으로 저장하는 로직으로 설명을 들었던것을 참고하여 구현하면 될것으로 보인..
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)
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..
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..
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..
Two Sum II - Input Array Is Sorted Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1
Valid Palindrome A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanatio..