Skip to content

Commit

Permalink
Merge pull request #1 from ritwiksingh21/ritwiksingh21-patch-1
Browse files Browse the repository at this point in the history
Solution to Bad Traingles
  • Loading branch information
ritwiksingh21 authored Sep 21, 2020
2 parents 876dd54 + 024b84e commit beda2fe
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Bad Triangle/Soluton_Bad_Triangles
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>

int main()
{
int t,i,n,count;
scanf("%d", &t);
while(t--){
count = 0;
scanf("%d", &n);
int arr[n];
for(i=0;i<n;i++){
scanf("%d", &arr[i]);
}
for(i=2;i<n;i++){
if(arr[0]+arr[1]<= arr[i]){
count++;
printf("%d %d %d\n", 1,2,i+1);
break;
}
}
if(count==0){printf("-1\n");}
}
return 0;
}

0 comments on commit beda2fe

Please sign in to comment.