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 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 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 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 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
| 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 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
| #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 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 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 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
| #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 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
| #include<iostream> | |
| #include<cstring> | |
| using namespace std; | |
| const int SIZE = 50; | |
| int main() { | |
| char line[SIZE]; | |
| memset(line, '\0', SIZE); |
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
| #include<iostream> | |
| #include<cmath> | |
| using namespace std; | |
| const int SIZE = 1000; | |
| int main() { | |
| int size; | |
| int list[SIZE], s1[SIZE], s2[SIZE]; |
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 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 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
| #include <iostream> | |
| using namespace std; | |
| /* | |
| * Complete the 'ranking3' function below. | |
| * | |
| * The function accepts INTEGER_ARRAY roulette as parameter. | |
| */ | |
| const int SIZE = 37; |