Compare commits

..

No commits in common. "6c39c4d46270a16d7cfbb82bb54d2bdb148f4f77" and "c72996f34290d4b26dabd7f08d516d665eae494a" have entirely different histories.

2 changed files with 3 additions and 33 deletions

View File

@ -226,34 +226,4 @@ public class Solution {
}
return dummy.next;
}
public int strStr(String haystack, String needle) {
if (needle.isEmpty()) return -1;
return haystack.indexOf(needle);
}
public int searchInsert(int[] nums, int target) {
if (nums.length == 0) return 0;
for (int i = 0; i < nums.length; i++) {
if (nums[i] >= target) {
return i;
}
}
return nums.length;
}
public int lengthOfLastWord(String s) {
if (s.isEmpty()) return 0;
for (int i = s.length() - 1; i >= 0; i--) {
if (s.charAt(i) != ' ') {
int count = 0;
while (i >= 0 && s.charAt(i) != ' ') {
count++;
i--;
}
return count;
}
}
return 0;
}
}

View File

@ -6,9 +6,9 @@ import java.util.stream.Collectors;
public class test {
public static void main(String[] args) {
int[] nums = new int[]{1,1,2};
int result = Solution.removeDuplicates(nums);
System.out.println(result);
int[] nums = new int[]{1,2,3,4,4,5,6};
boolean canJump = Solution.canJump(nums);
System.out.println(canJump);
}
}