본문 바로가기

728x90
반응형

Major-

(863)
[LeetCode- Ch.2 정렬 & 검색] 3. 원점에 가장 가까운 지점 ## (+ Double 정렬, PriorityQueue 정렬) https://leetcode.com/problems/k-closest-points-to-origin/submissions/ K Closest Points to Origin - 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 1. 제곱근 함수 : Math.sqrt() 2. 제곱 함수 : Math.pow() import java.util.*; class Point{ public double value; public int[] arr; Point(double valu..
[LeetCode- Ch.2 정렬 & 검색] 2. K번째 제일 큰 원소 (+ PriorityQueue) https://leetcode.com/problems/kth-largest-element-in-an-array/submissions/ Kth Largest Element in an Array - 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 1. 리스트 이용 2. 배열 이용 3. PriorityQueue 이용 import java.util.*; class Solution { public int findKthLargest(int[] nums, int k) { Li..
[LeetCode- Ch.2 정렬 & 검색] 1. 제로 이동 (+ allMatch, noneMatch, for-while) https://leetcode.com/problems/move-zeroes/submissions/ Move Zeroes - 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 import java.util.*; class Solution { public int[] moveZeroes(int[] nums) { //정수 배열에서 0이 아닌 값은 순서를 유지하고, 모든 0은 마지막으로 이동 //배열 복사본 만들지 않고 수행 //1.ds int n=nums.length; /..
[LeetCode- Ch.1 문자열] 4. 플러스 원 https://leetcode.com/problems/plus-one/submissions/ Plus One - 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 import java.util.stream.Stream; class Solution { public int[] plusOne(int[] digits) { //비어 있지 않은 십진수 배열 주어지면 1증가 //배열의 마지막 숫자에 +1 //숫자 0제외 정수 앞에 0미포함 int n = digits.length..
[LeetCode- Ch.1 문자열] 3. 라이센스 키 포맷 (+ StringBuilder.insert(위치,문자)) https://leetcode.com/problems/license-key-formatting/submissions/ License Key Formatting - 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 class Solution { public String licenseKeyFormatting(String s, int k) { //뒤에서부터 k개수만큼 자르고 사이에 '-' 문자 추가하기 //소문자일 경우 대문자로 변경 //1.ds //모든 '-'문자 제거..
[LeetCode- Ch.1 문자열] 2. 보석과 돌 (+ toCharArray) https://leetcode.com/problems/jewels-and-stones/submissions/ Jewels and Stones - 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 class Solution { public int numJewelsInStones(String jewels, String stones) { //1.ds char[] jew_arr = jewels.toCharArray(); int count=0; //2.loop for(cha..
[LeetCode- Ch.1 문자열] 1. 고유한 이메일 (+ StringBuilder, toCharArray) https://leetcode.com/problems/unique-email-addresses/submissions/ Unique Email Addresses - 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 import java.util.*; class Solution { public int numUniqueEmails(String[] emails) { int N=emails.length; Set set = new HashSet(); //2. Loop //: ..
[SW 아카데미] 3282. 0/1 Knapsack https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AWBJAVpqrzQDFAWr&categoryId=AWBJAVpqrzQDFAWr&categoryType=CODE&problemTitle=&orderBy=RECOMMEND_COUNT&selectCodeLang=ALL&select-1=3&pageSize=30&pageIndex=1 SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 1. 냅색 알고리즘 dy[] : 해당 인덱스에서 할 수 있는 최고의 선택 int n=kb.nextInt(); int m=kb.n..

728x90
반응형