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> | |
using namespace std; | |
int main() { | |
int a,b,c; | |
cin >> a >> b; | |
if(a > b) c = a; | |
else c = b; |
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.io.*; | |
import java.math.*; | |
import java.security.*; | |
import java.text.*; | |
import java.util.*; | |
import java.util.concurrent.*; | |
import java.util.function.*; | |
import java.util.regex.*; | |
import java.util.stream.*; | |
import static java.util.stream.Collectors.joining; |
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 <vector> | |
using namespace std; | |
vector<int> getKnapSackIndex(vector<vector<int>> items, vector<vector<int>> dp, int capacity){ | |
vector<int> sol; | |
int i=items.size(); | |
int j=capacity; | |
while(i > 0) { | |
if(dp[i][j] == dp[i-1][j]){ |
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
public static int bin2dec(SinglyLinkedListNode head) { | |
SinglyLinkedListNode tmp = head; | |
int count, num; | |
count = num = 0; | |
while(tmp != null) { | |
count++; | |
tmp = tmp.next; | |
} | |
tmp = head; | |
for(; count > 0; count--) { |
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; // Import the Scanner class | |
public class Main { | |
public static void main(String[] args){ | |
int n; | |
int buff; | |
Scanner scanner = new Scanner(System.in); // Create a Scanner object | |
Queue<Integer> myQueue = new Queue<Integer>(); |
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; // Import the Scanner class | |
public class Main { | |
public static void main(String[] args){ | |
int n; | |
int buff; | |
Scanner scanner = new Scanner(System.in); // Create a Scanner object | |
Stack<Integer> myStack = new Stack<Integer>(); |
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
class List<T extends Comparable<T>> { | |
private Node<T> head; | |
public List() { | |
this.head = null; | |
} | |
// Insert in Order | |
public void insert(T value) { | |
Node<T> n_node = new Node<T>(value); |
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; | |
class basura{ | |
public static class Bolsa{ | |
private int Volumen; | |
Bolsa(int V){ | |
Volumen = V; | |
} | |
public void setVol(int V){ |
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.io.*; | |
import java.util.*; | |
public class Solution { | |
static class KMP_String_Matching { | |
public Vector<Integer> KMPSearch(String pat, String txt) | |
{ | |
Vector<Integer> find_idxs = new Vector<Integer>(); | |
int M = pat.length(); | |
int N = txt.length(); |
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.*; | |
class TopologicalSort { | |
public static class Edge{ | |
int u; | |
int w; | |
public Edge(int u, int w) { | |
this.u=u; | |
this.w=w; | |
} |