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
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| var i = 1; | |
| async function demo() { | |
| while(true) { | |
| if (document.getElementsByTagName('button')[4]) { | |
| document.getElementsByTagName('button')[4].click(); |
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
| import java.io.*; | |
| import java.util.*; | |
| public class StandardDeviation { | |
| public static double getMean(int[] arr) { | |
| double mean = 0; | |
| for (int i = 0; i < arr.length; i++) | |
| mean += arr[i]; | |
| mean /= arr.length; |
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> | |
| #include <malloc.h> | |
| // defining the function f(x) | |
| double f (double x) { | |
| //return log(x); | |
| return x*x; | |
| } |
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
| import java.io.*; | |
| import java.util.*; | |
| public class MeanMedianMode { | |
| public static double getMean(int[] arr) { | |
| double mean = 0; | |
| for (int i = 0; i < arr.length; i++) | |
| mean += arr[i]; | |
| mean /= arr.length; |
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
| String n = sc.next(); | |
| Set<Integer> set = new HashSet<>(); // use set if you want unique else arraylist | |
| // method 1 | |
| for (int i = 0; i < n.length(); i++) { | |
| for (int j = i; j < n.length(); j++) { | |
| String s = n.substring(i, j + 1); | |
| set.add(Integer.parseInt(s)); | |
| } | |
| } |
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
| static void permute(List<String> symbols, List<String> permutations, int level) { | |
| if (level == symbols.size()) return; | |
| if (level == 0) { | |
| for (int i = 0; i < symbols.size(); i++) { | |
| permutations.add(symbols.get(i)); | |
| } | |
| permute(symbols, permutations, level + 1); | |
| } else { | |
| List<String> tempPerms = new ArrayList<>(); |
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
| class LeapYear { | |
| /** | |
| * author: Arpan Das | |
| * date: 05-sept-2018 | |
| * int year - year | |
| * char calendarType - G = Gregorian calendar, J= Julian Calendar | |
| * returns boolean | |
| */ | |
| public static boolean isLeapYear(int year, char calendarType) { | |
| if (calendarType == 'J') { // Julian Calendar |
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
| /** | |
| This function searches a 1D array within another 2D array | |
| author: Arpan Das | |
| date: 28-09-2018 | |
| char *** haystack - 2D string array | |
| char ** needle - 1D string array | |
| size_t hx_size - no of rows of haystack | |
| size_t hy_size - no of cols of haystack and no of elements of needle | |
| returns - 1 if found else 0 | |
| */ |
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 <stdlib.h> | |
| #include <string.h> | |
| #define TYPE char* | |
| unsigned long factorial(unsigned long f) { | |
| if (f == 0) return 1; | |
| return(f * factorial(f - 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
| #include <stdio.h> | |
| #include <string.h> | |
| #include <math.h> | |
| #include <stdlib.h> | |
| #define TYPE char* | |
| /** | |
| * Generates array difference between two arrays of any type | |
| * author: Arpan Das |
NewerOlder