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 EXIF from 'exif-js'; | |
const hasBlobConstructor = typeof (Blob) !== 'undefined' && (function checkBlobConstructor() { | |
try { | |
return Boolean(new Blob()); | |
} catch (error) { | |
return false; | |
} | |
}()); |
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
# print("hello to world from gaurav"); | |
# input will always be a string you have to typeCast to turn them into your desired data type | |
# x=int(input("Enter a number \t")); | |
# print (x); | |
# print(type(x)); | |
# if else | |
# if x>18: | |
# print("you are an adult") |
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 React, { createContext, useReducer } from "react"; | |
type IState = { | |
loginEmail: string; | |
loginPassword: string; | |
}; | |
const initialState: IState = { | |
loginEmail: "", | |
loginPassword: "", | |
}; |
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
package Recursion; | |
public class PowerOFX { | |
// Iterate | |
public static int itr(int x , int power) { | |
int result = 1; | |
for(int i = 1 ; i <= power ; i++ ){ | |
result = result * x; | |
} | |
return result; |
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
package Recursion; | |
import java.util.Scanner; | |
public class Recursion { | |
//Factorial | |
public static int fact( int n ){ | |
System.out.println("factorial of " + n); | |
if( n <= 1 ) return 1; //Base Condition | |
return n * fact(n-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
package Bitwise; | |
import java.util.Scanner; | |
class Converter{ | |
public String toBinary(int n) { | |
String result = ""; | |
while(n != 0){ | |
int lastbit = n & 1; | |
result = lastbit + result; | |
n = n >> 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
package BinaryAndDecimal; | |
import java.util.Scanner; | |
// Decimal to Binary Conversion | |
public class DecimalToBinary { | |
public static void main(String[] args) { | |
Scanner s=new Scanner(System.in); | |
System.out.print("Enter a number : "); | |
int decimal = s.nextInt(); | |
String result =""; |
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
package spaceTimeComplexity; | |
public class Quad { | |
public static void main(String[] args) { | |
int[] arr= new int[]{1,2,3,4,5,6,7,8,9,0,4,10}; | |
int target=10; | |
// Find the pair of Values in Array whose sum is equal to target | |
for(int i=0; i<arr.length;i++){ // Time C. -> O(n) | |
for (int j= i+1; j<arr.length;j++){ // Time C. ->O(n) times O(n) -> O(n^2) |
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
package spaceTimeComplexity; | |
public class Logarithmic { | |
public static void main(String[] args) { | |
//Binary Search | |
int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; | |
int target = 6; | |
int left = 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
package spaceTimeComplexity; | |
import java.util.Arrays; | |
public class Linear { | |
public static void main(String[] args) { | |
int[] arr =new int[]{1,2,3,4,5,6}; | |
//in our Constant space complexity the notation was O(1) | |
arr[0]=arr[0]+10; //System Complexity -> O(1) | |
System.out.println("arr[0] : " + arr[0]); //Time Complexity -> O(1) System Complexity -> O(1) | |
// Print elements of the array |
NewerOlder