본문 바로가기

전체 글

(24)
JVM은 어떻게 동작하는가? Introduction JVM(Java Virtual Machine)은 JRE(Java Runtime Environment)의 한 부분으로, Java 어플리케이션을 실행시키는 런타임 엔진이다. JVM은 소스코드 상의 main() 메소드를 호출하여 프로그램을 실행시킨다. 처음 자바를 접해본 사람이라면 JVM, JRE, JDK 등의 용어가 혼동이 되는 경우가 많다. 이를 위해 짧게 정리를 해보자면 아래와 같다. - JVM (Java Virtual Machine): 자바 클래스파일들을 로딩하여 어플리케이션을 수행시키는 가상 머신 - JRE (Java Runtime Environment): 자바 구동 환경. JVM + 시스템 라이브러리 - JDK (Java Development Kit): 자바 개발 키트, JR..
Leetcode: Longest Increasing Subsequence (LIS: 최장 증가 부분 수열) Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7]. Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest inc..
Leetcode: Maximum Profit in Job Scheduling We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime , endTime and profit arrays, you need to output the maximum profit you can take such that there are no 2 jobs in the subset with overlapping time range. If you choose a job that ends at time X you will be able to start another job that starts at tim..
Leetcode : Subsets Subsets I Given an integer array nums, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Example 1: Input: nums = [1,2,3] Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] Example 2: Input: nums = [0] Output: [[],[0]] 중복이 없는 array의 모든 부분집합을 구하는 문제이다. 아래에 소개한 방법처럼 recursive하게 풀 수도 있겠으나, 배열에 중복이 없으므로 각 원소는 각 부분집합에 속하는가/속하지 않는가의 두 가지 가능성밖에 없고, 결론적으로 ..