Skip to content

Instantly share code, notes, and snippets.

View ivorynoise's full-sized avatar
💭
I may be slow to respond.

Deepak Aggarwal ivorynoise

💭
I may be slow to respond.
View GitHub Profile
@ivorynoise
ivorynoise / p10341.cpp
Created October 11, 2016 11:50
UVA 10341 Sove it Binary search the answer
#include <bits/stdc++.h>
using namespace std;
#define EPS 1e-6
/*
Discuss this?
e^-x Decreasing
sin() Increasing
cos() Decreasing
tan() Increasing
x^2 Decreasing
@ivorynoise
ivorynoise / i
Created October 11, 2016 05:12
UVA 11057 Exact Sum
2
278 721
999
4
184 609 668 768
793
3
209 72 156
@ivorynoise
ivorynoise / i
Created October 11, 2016 01:43
UVA 10567 Helping Fill Bates Binary search the answer
GbAKfQMoTUzeoUAIcKBiqNdiSdZOReKaBRIJDDeFpPvENgAmUEifQTxQmcmvtAlxtmtobFiOEDbtcRIzsgGyeJcHQylOmiwYxfbnISwSNfLtbskpAlZhyTciDSioOlBizDVInqnIpjqkfgYkkxbBHFTQrjyORnnqpETFCyAhQBnUozjADQoAKPQEqXwOBNdMUICDKaRjLNAwSrxiJgbbDOIEgGXnMNjflIWAOYOuYfflBfxGAzaBpNeBKxDiMsDuqcuhFpGNBHxnfVjOMVWrbozBNLZyipoVYIxZkJOosqCALfxbvTMsfjlzbzfPVtZsHpESlhDExLHWyZNZGQYYOjoBVQoIGQcSGUvqberDTqLxIRFuusKaMeLRgnhOBCqUOCWNlNFdPgdPdnqHveqcnZYgTMlDXnzSINsdhbhWabOewzqrTbwuMmHytVfvUarmzwwAREZGdECNyHiblfssWiApRnWTnkyenttrhmrMzhZQDLqnFMtP
50
bZxGsxtYAOsZfwMrkvc
vFaQtmponNZRWonLycMxRXtYzGZti
XqzLVvzAdgosVIaX
qqXvMeAySEcJ
DuyTCFPeQraVlOUJ
dHaSyKrbTWBnzjesQZTNfCaqLxWa
ljZpSXvRvw
StBcnPVubhwgOLBl
@ivorynoise
ivorynoise / i.txt
Last active October 10, 2016 03:59
UVA 11935 Through the Desert Binary Search the Answer
0 Fuel consumption 10
100 Goal
0 Fuel consumption 5
100 Fuel consumption 30
200 Goal
0 Fuel consumption 20
10 Leak
25 Leak
25 Fuel consumption 30
50 Gas station
@ivorynoise
ivorynoise / i
Created September 27, 2016 03:52
UVA 193 Graph Coloring
100
13 16
8 6
1 2
7 3
13 9
1 11
1 6
11 3
2 4
@ivorynoise
ivorynoise / addInf.cpp
Created September 25, 2016 04:33
Add numbers of infinite length Amazon
#include <bits/stdc++.h>
using namespace std;
int arr1[100] = {0}, arr2[100] = {0}, res[100];
void print(int arr[], int sz){
int i = -1;
while (arr[++i] == 0);
while (i < sz) cout << arr[i++];
cout << endl;
}
@ivorynoise
ivorynoise / balParant.java
Last active September 23, 2016 14:23
Check if balanced parantheses Amazon
import java.util.*;
class balParant{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
String str = s.nextLine();
System.out.println(check(str));
}
public static boolean check(String s){
char[] exp = s.toCharArray();
@ivorynoise
ivorynoise / wordsRev.java
Created September 23, 2016 12:44
Reverse Individual words in a string Amazon
import java.util.*;
class wordsRev{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
String inp = s.nextLine();
String rev = wordsReverse(inp);
System.out.println(rev);
}
@ivorynoise
ivorynoise / largestSubarray.java
Created September 23, 2016 11:56
Largest Subarray with given sum Amazon
import java.util.*;
class largestSubarray{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int sum = s.nextInt();
int num[] = new int[n];
for (int i = 0; i < n; ++i)
num[i] = s.nextInt();
@ivorynoise
ivorynoise / wordReverse.cpp
Created September 22, 2016 03:41
Reverse each word of sentence Amazon
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
// int rev(string &s){
// int be = 0;
// int en = s.size();
// int sp = 0;
// while(sp != string::npos && be < en){
// sp = find()