This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| int main(){ | |
| int s[91]={0}, max=0, chr=0; | |
| char str[1000001]; | |
| scanf("%s", str); | |
| int len = strlen(str); | |
| for(int i=0;i<len;i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| int main(){ | |
| char s[1000001];int num=0; | |
| gets(s); | |
| for(int i=0;i<strlen(s);i++){ | |
| if(s[i]==' '){ | |
| num++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <math.h> | |
| void hanoi(int n, int a, int b); | |
| int main(){ | |
| int n; | |
| scanf("%d", &n); | |
| int count = pow(2,n)-1; | |
| printf("%d\n", count); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| void hanoi(int n, int a, int b); | |
| void h_count(int n, int a, int b); | |
| int count; | |
| int main(){ | |
| int n; | |
| scanf("%d", &n); | |
| h_count(n,1,3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int arr[1000001]; | |
| void merge(int left, int mid, int right){ | |
| int left_end, pos, num_items; | |
| int num[1000001]; | |
| pos=left; | |
| left_end=mid-1; | |
| num_items=right-left+1; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int getHeight(struct node* root) { | |
| int left_h, right_h; | |
| if(root){ | |
| left_h = getHeight(root->left); | |
| right_h = getHeight(root->right); | |
| return 1+((left_h>right_h)?left_h:right_h); | |
| } | |
| else { | |
| return -1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int getHeight(struct node* root) { | |
| int left_h, right_h; | |
| if(root){ | |
| left_h = getHeight(root->left); | |
| right_h = getHeight(root->right); | |
| return 1+((left_h>right_h)?left_h:right_h); | |
| } | |
| else { | |
| return -1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int getHeight(struct node* root) { | |
| int left_h, right_h; | |
| if(root){ | |
| left_h = getHeight(root->left); | |
| right_h = getHeight(root->right); | |
| return 1+((left_h>right_h)?left_h:right_h); | |
| } | |
| else { | |
| return -1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct node* insert( struct node* root, int data ) { | |
| struct node *node = (struct node *)malloc(sizeof(struct node)); | |
| struct node *temp, *prev; | |
| node->data = data; | |
| node->left=node->right=NULL; | |
| if(root==NULL){//root is empty | |
| root=node; | |
| return root; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(){ | |
| int n, arr[1000], i, j, temp; | |
| scanf("%d", &n); | |
| for(i=0;i<n;i++){ | |
| scanf("%d", &arr[i]); | |
| } | |
| for(i=1;i<n;i++){ |
NewerOlder