Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf80a7e1

Browse files
add skeleton for 1200
1 parentddbfd06 commitf80a7e1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
packagecom.fishercoder.solutions;
2+
3+
importjava.util.List;
4+
5+
/**
6+
* 1200. Minimum Absolute Difference
7+
*
8+
* Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements.
9+
* Return a list of pairs in ascending order(with respect to pairs), each pair [a, b] follows
10+
* a, b are from arr
11+
* a < b
12+
* b - a equals to the minimum absolute difference of any two elements in arr
13+
*
14+
* Example 1:
15+
* Input: arr = [4,2,1,3]
16+
* Output: [[1,2],[2,3],[3,4]]
17+
* Explanation: The minimum absolute difference is 1. List all pairs with difference equal to 1 in ascending order.
18+
*
19+
* Example 2:
20+
* Input: arr = [1,3,6,10,15]
21+
* Output: [[1,3]]
22+
*
23+
* Example 3:
24+
* Input: arr = [3,8,-10,23,19,-4,-14,27]
25+
* Output: [[-14,-10],[19,23],[23,27]]
26+
*
27+
* Constraints:
28+
* 2 <= arr.length <= 10^5
29+
* -10^6 <= arr[i] <= 10^6
30+
* */
31+
publicclass_1200 {
32+
publicstaticclassSolution1 {
33+
publicList<List<Integer>>minimumAbsDifference(int[]arr) {
34+
returnnull;
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp