Compare commits
No commits in common. "8f15fee32e75695e06c86535b6edbc7043a1d101" and "a83429a6b794491f269fccaa74b710ca4abc514b" have entirely different histories.
8f15fee32e
...
a83429a6b7
|
|
@ -81,33 +81,31 @@ public class Solution {
|
||||||
}
|
}
|
||||||
//合并数组冒泡排序实现
|
//合并数组冒泡排序实现
|
||||||
public static void merge(int[] nums1, int m, int[] nums2, int n) {
|
public static void merge(int[] nums1, int m, int[] nums2, int n) {
|
||||||
System.arraycopy(nums2, 0, nums1, m, n);
|
int[] nums= new int[m + n];
|
||||||
|
for (int i = 0; i < m + n; i++) {
|
||||||
|
if (i < m){
|
||||||
|
nums[i] = nums1[i];
|
||||||
|
} else {
|
||||||
|
nums[i] = nums2[i - m];
|
||||||
|
}
|
||||||
|
}
|
||||||
// 冒泡排序
|
// 冒泡排序
|
||||||
for (int i = 0; i < nums1.length; i++) {
|
for (int i = 0; i < nums.length; i++) {
|
||||||
for (int j = 0; j < nums1.length; j++) {
|
for (int j = 0; j < nums.length; j++) {
|
||||||
if (i != j) {
|
if (i != j) {
|
||||||
if (nums1[i] < nums1[j]){
|
if (nums[i] < nums[j]){
|
||||||
int temp = nums1[i];
|
int temp = nums[i];
|
||||||
nums1[i] = nums1[j];
|
nums[i] = nums[j];
|
||||||
nums1[j] = temp;
|
nums[j] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nums1 = nums;
|
||||||
String result = Arrays.stream(nums1).mapToObj(String::valueOf).collect(Collectors.joining(",", "[", "]"));
|
String result = Arrays.stream(nums1).mapToObj(String::valueOf).collect(Collectors.joining(",", "[", "]"));
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
public static int removeElement(int[] nums, int val) {
|
|
||||||
for (int i = 0; i < nums.length; i++) {
|
|
||||||
if (val == nums[i]){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nums.length;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
// public static String longestCommonPrefix(String[] strs) {
|
// public static String longestCommonPrefix(String[] strs) {
|
||||||
// int index = 0;
|
// int index = 0;
|
||||||
// StringBuilder temp = new StringBuilder();
|
// StringBuilder temp = new StringBuilder();
|
||||||
|
|
@ -159,5 +157,4 @@ public class Solution {
|
||||||
return strs[0];
|
return strs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
>>>>>>> a83429a6b794491f269fccaa74b710ca4abc514b
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue