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
/* Copyright 2017 Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cstring> | |
using namespace std; | |
typedef long long int64; | |
typedef unsigned long long uint64; |
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
/* Copyright 2017 Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int64; | |
typedef unsigned long long uint64; | |
const double kEps = 10e-8; | |
const int kMax = 1000; | |
const int kInf = 1 << 30; | |
const int kFail = -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
You have a list of numbers, each number is in the range [1,1,000,000], you want | |
to find the prime factors of all of them. As usual you want to process the list | |
in the least amount of time, that's why you will will try to parallelize the process. | |
Implement an algorithm to process the list using threads, at any point you should have at most 8 threads running. |
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
Implement a LRU (Least Recent Used) cache. | |
Your system queries a database for every request from your clients, you want to | |
serve your clients as fast as possible, in order to that you will implement a | |
cache on top of the database, this cache can store up to 100,000 results and | |
the eviction policy is LRU, that is, when the cache is full, you will remove | |
the least-recent used record. | |
You're implementation should be as efficient as possible because this will be a | |
critical component of our system. |
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.Iterator; | |
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; | |
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; | |
import com.amazonaws.services.dynamodbv2.document.DynamoDB; | |
import com.amazonaws.services.dynamodbv2.document.Table; | |
import com.amazonaws.services.dynamodbv2.document.spec.ScanSpec; | |
import com.amazonaws.services.dynamodbv2.document.ItemCollection; | |
import com.amazonaws.services.dynamodbv2.document.ScanOutcome; | |
import com.amazonaws.services.dynamodbv2.document.Item; |
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 com.amazonaws.services.dynamodbv2.AmazonDynamoDB; | |
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; | |
import com.amazonaws.services.dynamodbv2.document.DynamoDB; | |
import com.amazonaws.services.dynamodbv2.document.Table; | |
import com.amazonaws.auth.AWSCredentials; | |
import com.amazonaws.auth.profile.ProfileCredentialsProvider; | |
import com.amazonaws.regions.Region; | |
import com.amazonaws.regions.Regions; |
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
/* Copyright 2017 Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <set> | |
#include <bitset> | |
#include <queue> | |
#include <map> |
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
/* Copyright 2017 Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <set> | |
#include <bitset> | |
#include <queue> | |
#include <map> |
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
/* Copyright 2017 Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <set> | |
#include <queue> | |
#include <map> |
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
/** Built using CHelper plug-in, Actual solution is at the top. */ | |
//region | |
import java.io.*; | |
import java.util.*; | |
import java.math.BigInteger; | |
public class Main { | |
public static void main(String[] args) { | |
InputStream inputStream = System.in; | |
OutputStream outputStream = System.out; |