This file contains 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> | |
#include <math.h> | |
#include <stdlib.h> | |
void get_meta(long int* meta_data){ | |
// getting the meta data of the problem | |
for (long int i = 0; i < 3; i++){ | |
scanf("%ld", &meta_data[i]); |
This file contains 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 <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
char get_min (char* u, char* s){ |
This file contains 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 <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
int main(){ | |
int n; |
This file contains 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
function findElement(arr, func) { | |
var num; | |
for(var i = 0; i < arr.length; i++){ | |
if(func(arr[i])) { return arr[i]; } | |
} | |
return num; | |
} | |
findElement([1, 2, 3, 4], function(num){ return num % 2 === 0; }); |
This file contains 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
function LCM(a, b){ | |
var min; | |
var max; | |
var maxmul = 1; | |
var minmul = 1; | |
// just in case... | |
if(a > b){ | |
max = a; | |
min = b; |
This file contains 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
function checkPrime(num){ | |
for(var i = 2; i < num-1; i++){ | |
if(num%i === 0){ | |
return false; | |
} | |
} | |
return true; | |
} | |
function sumPrimes(num) { |
This file contains 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
function sumFibs(num){ | |
var sum = 0; | |
var first = 0; | |
var second = 1; | |
var total = 0; | |
while(second <= num){ | |
first = second; | |
if (first%2 == 1){ | |
total = total + first; | |
} |
This file contains 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
function convertHTML(str) { | |
// :) | |
//replacing & | |
str = str.replace(/&/g, '&').replace(/</g,'<').replace(/>/g, '>') | |
.replace(/"/g,'"').replace(/'/g, '''); | |
return str; | |
} |
This file contains 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
function convertHTML(str) { | |
// :) | |
//replacing & | |
str = str.replace(/&/g, '&').replace(/</g,'<').replace(/>/g, '>') | |
.replace(/"/g,'"').replace(/'/g, '''); | |
return str; | |
} |
This file contains 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
function uniteUnique(arr) { | |
var args = Array.from(arguments); | |
var unique = []; | |
for(var i = 0; i < args.length; i++){ | |
for (var j = 0; j < args[i].length; j++){ | |
var flag = 0; | |
for(var k = 0; k < unique.length; k++){ | |
if(args[i][j] == unique[k]){ |