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

Commitac3f8e3

Browse files
authored
Merge pull requestneetcode-gh#3191 from nsk126/main
Added 1984-minimum-difference-between-highest-and-lowest-of-k-scores.c
2 parentsf5546f1 +6bb3acc commitac3f8e3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
intcmp(constvoid*a,constvoid*b) {
2+
return*(int*)a-*(int*)b;
3+
}
4+
5+
intmin(inta,intb){
6+
if(a>b)returnb;
7+
returna;
8+
}
9+
10+
intminimumDifference(int*nums,intnumsSize,intk) {
11+
if (k==1)return0;
12+
13+
qsort(nums,numsSize,sizeof(int),cmp);
14+
intres=1e5;
15+
intl=0;
16+
intr=k-1;
17+
18+
while (r<numsSize)
19+
{
20+
res=min(res,nums[r]-nums[l]);
21+
l+=1;
22+
r+=1;
23+
}
24+
25+
returnres;
26+
}

‎ruby/1929-concatenation-of-array.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# @return {Integer[]}
33
defget_concatenation(nums)
44
nums +nums
5-
end
5+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp