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
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); |
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
Hi This is a demo |
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
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; |
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
// 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]; | |
} | |
} |
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 <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(); |
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 <iostream> | |
#include <cstdio> | |
#include <cmath> | |
#include <vector> | |
#include <map> | |
#include <set> | |
#include <string> | |
#include <cstring> | |
#include <algorithm> | |
#include <iomanip> |
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 <cstdio> | |
#include <cstring> | |
#include <algorithm> | |
char code[1000]; | |
char inp[1000]; | |
int maxLen = 0; | |
void decode() { | |
//prints a pattern corresponding to code |
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 <bits/stdc++.h> | |
using namespace std; | |
#define MAXN 200 | |
char grid[MAXN][MAXN]; | |
void clean(){ | |
char c; | |
while ((c = getchar()) != '\n' && c != EOF); | |
} |
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
2 | |
5 | |
1 6 7 11 13 | |
4 | |
3 9 10 14 |
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
6 | |
82 | |
1 | |
21 | |
6 | |
20 | |
21 | |
72 | |
2 | |
1 |
NewerOlder