Skip to content

Instantly share code, notes, and snippets.

View saadzarook's full-sized avatar
💭
Preparations...

Sa'ad Zarook saadzarook

💭
Preparations...
View GitHub Profile
@saadzarook
saadzarook / ISP2.c
Created May 18, 2017 17:04
Insertion Sort-Part 2 HackerRank Problem
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
void insertionSort(int ar_size, int * ar) {
int temp;
for(int i = 0; i < ar_size-1;i++){
if(ar[i]>ar[i+1]){
for(int j=0;j<i+1;j++){
@saadzarook
saadzarook / Pangrams.c
Created May 17, 2017 18:12
Pangrams-HackerRank Problem
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
char s[1000];
scanf(" %[^\n]s", s);
int l=strlen(s),r=0;
for(int i=1;i<=25;i++){
@saadzarook
saadzarook / CTS.c
Created May 17, 2017 15:22
Cut the sticks -HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
void quicksort(int number[],int first,int last){
int i, j, pivot, temp;
@saadzarook
saadzarook / prisoner.c
Created May 13, 2017 04:14
Save the Prisoner ! -HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main() {
int t;
@saadzarook
saadzarook / Birthday.c
Created May 12, 2017 17:03
Birthday Chocolate-HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int getWays(int squares_size, int* squares, int d, int m){
int j,k=1,t=m,sum=0,count=0;
@saadzarook
saadzarook / PDF.c
Created May 12, 2017 11:18
Designer PDF Viewer-HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int *h = malloc(sizeof(int) * 26);
@saadzarook
saadzarook / JOCR.c
Created May 12, 2017 04:31
Jumping on the Clouds:Revisited-HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int n;
@saadzarook
saadzarook / JOC_HR.c
Created May 12, 2017 04:01
Jumping on Clouds - HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int n;
@saadzarook
saadzarook / CV-HR.c
Created May 11, 2017 10:26
Counting Valleys -HackerRank Problem
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n;
scanf("%d",&n);
char s[n];
for(int i=0;i<n;i++){
@saadzarook
saadzarook / MinDistancesHR.c
Created May 5, 2017 05:29
Minimum Distances -HackerRank Problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int n;