mirror of https://github.com/THUDM/CodeGeeX.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
403 B
Plaintext
16 lines
403 B
Plaintext
code translation
|
|
Java:
|
|
public class Solution {
|
|
public static boolean hasCloseElements(int[] nums, int threshold) {
|
|
for (int i = 0; i < nums.length - 1; i++) {
|
|
for (int j = i + 1; j < nums.length; j++) {
|
|
if (Math.abs(nums[i] - nums[j]) < threshold) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
Python:
|