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
import java.util.Scanner;
public class knapsack{
public static void main(String args[]){
int n;
Scanner scn = new Scanner(System.in);
n = scn.nextInt();
int[] weight = new int[n];
inputArr(weight, scn);
Hi This is a demo
void findPermutations(vector<int>A, int i, vector<vector<int> >& all){
if (i == A.size()){
all.push_back(A);
return ;
}
vector<int> sortedCopy(A);
for(int pos = i; pos < A.size(); ++pos){
swap(sortedCopy[i], sortedCopy[pos]);
A = sortedCopy;
// Deepak Aggarwal, Coding Blocks
// deepak@codingblocks.com
#include <iostream>
using namespace std;
void inputMat(char mat[][10], int m, int n){
for(int r = 0; r < m; ++r){
for(int c = 0; c < n; ++c){
cin >> mat[r][c];
}
}
#include <bits/stdc++.h>
using namespace std;
void printStr(string& s) {
cout << "X" << s << "X" << endl;
}
void removeDup1(string& s) {
bool duplicateFound = false;
int len = s.size();
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
@ivorynoise
ivorynoise / picascii.cpp
Created August 24, 2017 10:23
Thug Life Code
#include <cstdio>
#include <cstring>
#include <algorithm>
char code[1000];
char inp[1000];
int maxLen = 0;
void decode() {
//prints a pattern corresponding to code
@ivorynoise
ivorynoise / p00183.cpp
Created October 12, 2016 11:41
UVA 00183 Bit Maps Binary search simulation
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200
char grid[MAXN][MAXN];
void clean(){
char c;
while ((c = getchar()) != '\n' && c != EOF);
}
@ivorynoise
ivorynoise / i
Created October 12, 2016 04:42
UVA 12032 The Monkey and the Oiled Bamboo
2
5
1 6 7 11 13
4
3 9 10 14
@ivorynoise
ivorynoise / d
Created October 12, 2016 03:14
UVA 11413 Fill the ...
6
82
1
21
6
20
21
72
2
1