Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions 05월/1주차/[LCD] Palindrome Number/Min.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Min {
public boolean isPalindrome(int x) {
String s = Integer.toString(x);
String reverse = new StringBuilder(s).reverse().toString();

if(s.equals(reverse)) {
return true;
}
return false;
Comment on lines +6 to +9
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 return 을 s.equals(reverse)로 할 수도 있을 것 같아요!

}
}
16 changes: 16 additions & 0 deletions 05월/1주차/[LCD] Two Sum/Min.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Min {
public int[] twoSum(int[] nums, int target) {
int[] answer = new int[2];
for(int i = 0; i < nums.length - 1; i++) {
for(int j = i + 1; j < nums.length; j++) {
if(nums[i] + nums[j] == target) {
answer[0] = i;
answer[1] = j;
break;
}
}
}
return answer;

}
}
23 changes: 23 additions & 0 deletions 05월/1주차/[PRGRMS] 야근 지수/Min.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import java.util.*;

class Min {
public long solution(int n, int[] works) {
long answer = 0;
PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());

for(int work : works) {
pq.offer(work);
}

for(int i = 0; i < n; i++) {
int work = pq.poll();
work = work - 1 >= 0 ? work - 1 : 0;
pq.offer(work);
}

while(!pq.isEmpty()) {
answer += Math.pow(pq.poll(), 2);
}
return answer;
}
}