Wednesday, 22 October 2014

Hackerrank Angry Childrem Solution

The Solution for hackerrank poblem, Angry Childrem Solution using C++ program.
Passed Testcases : 15 out of 15
Source Code:

 #include <stdio.h>  
 #include <string.h>  
 #include <math.h>  
 #include <stdlib.h>  
 #include <algorithm>  
 using namespace std;  
 #define MAX 100000  
 #define MAX_VAL 1000000001  
 int candies[MAX];  
 int main() {  
   int N,K;  
   int i,upper,lower[MAX];  
   scanf("%d %d",&N,&K);  
   for(i = 0;i < N;i++){  
     scanf("%d",candies + i);  
   int unfairness =  candies[K-1]-candies[0];  
 for(i = 0;i < N-K-1;i++){  
     unfairness = candies[i+K-1]-candies[i];  
   return 0;  

1 comment:

  1. If you are looking for a healthy diet plan...! Here we offer you a fibromyalgia diet plan for free of cost.