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 <cmath> | |
| #include <cstdio> | |
| #include <vector> | |
| #include <iostream> | |
| #include <algorithm> | |
| #include <new> | |
| using namespace std; | |
| template <typename T, size_t SmallSizeThreshold> | |
| class SmallVector { |
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 <stdio.h> | |
| #include <math.h> | |
| #include <stdlib.h> | |
| #include<bits/stdc++.h> | |
| using namespace std; | |
| struct ListNode { | |
| int val; | |
| ListNode* next = nullptr; | |
| ListNode(int data):val(data){} |
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 <string> | |
| #include <stdio.h> | |
| #include <string.h> | |
| using namespace std; | |
| struct suffix_tree { | |
| std::string suffix; | |
| suffix_tree* child[26] = {}; | |
| int index = 0; |
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 <unordered_set> | |
| #include <ctime> | |
| #include <vector> | |
| constexpr int n = 10; | |
| int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; | |
| int dy[8] = {1, 1, 1, 0, 0, -1, -1, -1}; | |
| bool gameOver = false; |
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.ArrayList; | |
| public class Board { | |
| private int[][] board; | |
| private final int n; | |
| private int hammingDist; | |
| private int manhattanDist; | |
| private int blankX, blankY; | |
| // create a board from an n-by-n array of tiles, | |
| // where tiles[row][col] = tile at (row, col) |
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 <string> | |
| #include <cstdlib> | |
| #include <limits> | |
| #include <locale> | |
| #include <sstream> | |
| #include <iomanip> | |
| #include <cassert> | |
| template<class T> |
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 class MyString { | |
| private char[] buffer; | |
| private MyString next = null; | |
| private int len = 0; | |
| public MyString(char[] data) { | |
| buffer = data.clone(); | |
| len += data.length; |
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
| function calculate() { | |
| var total_miles = 0; | |
| var avg_daily_miles = 0; | |
| for (var i=1; i<=7; i++) { | |
| var dist = +document.getElementsByName("value" + i)[0].value; | |
| total_miles += dist; | |
| avg_daily_miles += dist/7.0; | |
| } | |
| document.getElementById("totalM").value = total_miles; | |
| document.getElementById("avgM").value = avg_daily_miles; |
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.*; | |
| /*public*/ interface Cipher { | |
| public abstract String encode(String plainText); | |
| } | |
| /*public*/ class ShiftN_Cipher implements Cipher { | |
| public ShiftN_Cipher(int shifts) { | |
| this.shifts = shifts; | |
| } |
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 <string> | |
| #include <vector> | |
| #include<bits/stdc++.h> | |
| using namespace std; | |
| void insertSorted(stack<int>& s, int e) { | |
| stack<int> temp; | |
| while (true) { | |
| if (s.empty() || e >= s.top()) { |
NewerOlder