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
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
class Mun {
public int searchInsert(int[] nums, int target) {
int end = nums.length - 1;
int front = 0;
while(front <= end) {
int mid = (end + front) / 2;
int n = nums[mid];
if(n > target) {
end = mid - 1;
} else if (n < target) {
front = mid + 1;
} else {
return mid;
class Solution {
public int strStr(String haystack, String needle) {
int len = needle.length();

for(int i=0;i<haystack.length()-len+1;i++) {
boolean same = true;
for(int j=0;j<len;j++) {
if(haystack.charAt(i+j) != needle.charAt(j)) {
same = false;
break;
}
}
if(same) {
return i;
}
}
return front;

return -1;
}
}
6 changes: 6 additions & 0 deletions 06월/3주차/[LCD] Length of Last Word/Mun.java

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.

확실하고 깔끔한 풀이.... 굳이네요....👍🏻

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Mun {
public int lengthOfLastWord(String s) {
String[] arr = s.split(" ");
return arr[arr.length-1].length();
}
}
14 changes: 14 additions & 0 deletions 06월/3주차/[LCD] Plus One/Mun.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Mun {
public int[] plusOne(int[] digits) {
for(int i=digits.length-1;i>=0;i--) {
if(digits[i] < 9) {
digits[i]++;
return digits;
}
digits[i] = 0;
}
int[] ans = new int[digits.length+1];
ans[0] = 1;
return ans;
}
}