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.HashMap; | |
public class AkariDaisukiDiv2 { | |
public int countTuples(String S) { | |
int ans = 0; | |
HashMap map = new HashMap<String, Integer>(); | |
for(int i = 1; i < S.length(); i++){ |
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.HashMap; | |
public class AkariDaisukiDiv2 { | |
public int countTuples(String S) { | |
int ans = 0; | |
HashMap map = new HashMap<String, Integer>(); | |
for(int i = 1; i < S.length(); i++){ |
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
class EmptyQueueException(Exception): | |
pass | |
class LinkedListQueueNode: | |
def __init__(self, data): | |
self._next = None | |
self._data = data | |
def set_next(self, n): | |
self._next = n |
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
def powerset(L): | |
ret = [tuple(L)] | |
if len(L) == 0: | |
return ret | |
for i in range(len(L)): | |
ret += powerset(L[:i] + L[i+1:]) |
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
def permute(L): | |
if len(L) == 1: | |
return [L] | |
ret = [] | |
for i in range(len(L)): | |
X = permute(L[:i] + L[i+1:]) | |
for sub_list in X: |
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
def msort(L): | |
if len(L) == 1: | |
return L | |
m = len(L)/2 | |
return merge(msort(L[:m]), msort(L[m:])) | |
def merge(left, right): |
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
1 def rec(L, p=0): | |
2 ans = [] | |
3 if p > len(L): | |
4 return ans | |
5 | |
6 ans.append(sum(L[:p])) | |
7 ans += rec(L, p+1) | |
8 | |
9 return ans |
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
class FrameOne extends JFrame{ | |
private void init(){ | |
FrameTwo f = new FrameTwo("Hi"); | |
f.setVisible(true); | |
} | |
//main method calls init. | |
} |
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
int MinimumLiars::getMinimum(vector <int> claim) { | |
for (int i=0;i<claim.size();i++){ | |
int count=0; | |
for (int j=0;j<claim.size();j++) | |
if(claim[j]>i+1) | |
count++; | |
if (count==i+1) | |
return i+1; | |
} |
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> | |
#include <list> | |
#include <map> | |
#include <set> | |
#include <queue> | |
#include <deque> | |
#include <stack> | |
#include <bitset> | |
#include <algorithm> | |
#include <functional> |