Compare commits
9 Commits
a83429a6b7
...
8f15fee32e
| Author | SHA1 | Date |
|---|---|---|
|
|
8f15fee32e | |
|
|
0eb5aa8e9e | |
|
|
1bdd2f6973 | |
|
|
239dcec5ae | |
|
|
85497363cf | |
|
|
a264682bc4 | |
|
|
05b608b6d9 | |
|
|
22bc22261f | |
|
|
bf2e20cde9 |
|
|
@ -81,31 +81,33 @@ public class Solution {
|
|||
}
|
||||
//合并数组冒泡排序实现
|
||||
public static void merge(int[] nums1, int m, int[] nums2, int 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];
|
||||
}
|
||||
}
|
||||
System.arraycopy(nums2, 0, nums1, m, n);
|
||||
// 冒泡排序
|
||||
for (int i = 0; i < nums.length; i++) {
|
||||
for (int j = 0; j < nums.length; j++) {
|
||||
for (int i = 0; i < nums1.length; i++) {
|
||||
for (int j = 0; j < nums1.length; j++) {
|
||||
if (i != j) {
|
||||
if (nums[i] < nums[j]){
|
||||
int temp = nums[i];
|
||||
nums[i] = nums[j];
|
||||
nums[j] = temp;
|
||||
if (nums1[i] < nums1[j]){
|
||||
int temp = nums1[i];
|
||||
nums1[i] = nums1[j];
|
||||
nums1[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nums1 = nums;
|
||||
String result = Arrays.stream(nums1).mapToObj(String::valueOf).collect(Collectors.joining(",", "[", "]"));
|
||||
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) {
|
||||
// int index = 0;
|
||||
// StringBuilder temp = new StringBuilder();
|
||||
|
|
@ -157,4 +159,5 @@ public class Solution {
|
|||
return strs[0];
|
||||
}
|
||||
|
||||
>>>>>>> a83429a6b794491f269fccaa74b710ca4abc514b
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue